PC Review


Reply
Thread Tools Rate Thread

Detailsview - how do I add the first record?

 
 
JonBosker
Guest
Posts: n/a
 
      1st Feb 2007
Help...

I have a brand new database table and I open the page that has a
DetailsView control that is bound to that table it does not show
anything - not even a new button - so how can I add the first
record??

The reason I ask is because I have a generic page that will display
data from any table. Therefore I cannot add the row programmatically
-
I have tried adding blank values (by querying the SQL Server schema
(SELECT COLUMN_NAME, DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE
TABLE_NAME = MyTable) but that does not work if the table has foreign
key constraints etc..

Any ideas?

Thanks in advance,
Jon

dbgurus.com.au

 
Reply With Quote
 
 
 
 
Alexey Smirnov
Guest
Posts: n/a
 
      1st Feb 2007
On Feb 1, 10:58 am, "JonBosker" <Jon.Bos...@Yahoo.com> wrote:
> Help...
>
> I have a brand new database table and I open the page that has a
> DetailsView control that is bound to that table it does not show
> anything - not even a new button - so how can I add the first
> record??
>
> The reason I ask is because I have a generic page that will display
> data from any table. Therefore I cannot add the row programmatically
> -
> I have tried adding blank values (by querying the SQL Server schema
> (SELECT COLUMN_NAME, DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE
> TABLE_NAME = MyTable) but that does not work if the table has foreign
> key constraints etc..
>


SELECT COLUMN_NAME, DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE
TABLE_NAME = MyTable

will return you result when it exists.

That is you have to insert the row into COLUMNS before.

For example (abstract)

if (table_has_no_rows)
{
insert_row();
} else {
get_rows();
}

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DetailsView With no Record hon123456 Microsoft ASP .NET 1 24th Jul 2009 10:20 AM
DetailsView - When do you get the new record value after an insert?? MU Microsoft Dot NET 3 26th Jan 2009 06:03 PM
DetailsView - How do I get the new record's ID after Insert? MU Microsoft ASP .NET 1 26th Jan 2009 03:30 PM
DetailsView - the Very First Record JonBosker Microsoft C# .NET 0 1st Feb 2007 06:28 AM
Detailsview adding first record =?Utf-8?B?VGRhclRkYXI=?= Microsoft ASP .NET 2 12th Sep 2005 08:08 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:37 AM.