Need help with ASP.NET and MS SQL!

Discussion in 'Databases' started by jessecooper, Apr 20, 2009.

  1. #1
    Hey guys,

    I'm finishing up a class project and I'm having trouble with automatically creating primary keys for various tables.

    I'm wanting the C# code behind the Aspx to look into my 'Events' table and find the last occurring entry then take that Primary Key and add 1 to it, then display that new number in a greyed out textbox, and eventually save it to the db with InsertParameters if the entry is submitted. I'm pretty new to both C# and ASP.net and didn't know if you all could help me figure this out!

    Also how would I scan through the DB with a loop to see if the new number already exists?

    Thanks Everyone!:confused:
     
    jessecooper, Apr 20, 2009 IP
  2. jessecooper

    jessecooper Peon

    Messages:
    793
    Likes Received:
    33
    Best Answers:
    0
    Trophy Points:
    0
    #2
    figured it out, thanks
     
    jessecooper, Apr 20, 2009 IP
  3. websolutions_777

    websolutions_777 Banned

    Messages:
    249
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Hi there,

    You can scan each row using ADO.NET Dataset, loop through dataset using eg foreach( ds.rows.count>0)

    Regards,

    WS
     
    websolutions_777, Apr 21, 2009 IP