Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Detailsview - how do I add the first record?

Reply
Thread Tools

Detailsview - how do I add the first record?

 
 
JonBosker
Guest
Posts: n/a
 
      02-01-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
 
      02-01-2007
On Feb 1, 10:58 am, "JonBosker" <(E-Mail Removed)> 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

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
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
How to add a cell to the end of the first row of the first table on a page? sherifffruitfly Javascript 0 04-25-2007 04:04 AM
DetailsView - Changing to Insert Mode (Not By Using the Insert Button In the DetailsView Control) Feege ASP .Net Web Controls 0 12-20-2005 12:28 AM
Detailsview adding first record =?Utf-8?B?VGRhclRkYXI=?= ASP .Net 2 09-12-2005 07:08 PM
How to add the DropDownList and TextBox Control in DetailsView Murugan V via DotNetMonster.com ASP .Net 0 01-08-2005 09:27 AM



Advertisments