add or update record

wadisnake

New Member
what ia mtrying to accomplisg is if the record already exist in the database update it else add anew record ..just like <BR>if rs.eof then<BR>...add new record<BR>else<BR>update this record<BR>end if in<BR>ASP.But i don't see anything equivalent to rs.eof in asp.net..here the code snippet that i have<BR><BR><BR> 'If "what..should ho here." Then<BR> 'strSQL = "update Dd " & _<BR> ' "set name ='" & name & "'," & _<BR> '' "customername ='" & customername & "'" & _<BR> ' "Address ='" & Address & "'" & _<BR> <BR> ' "where name='" & doc & "'"<BR><BR> 'Else<BR> strSQL = "Insert into Dd(name,name,customername,Address)" & _<BR> "values('" & docs & "','" & name & "','" & customername & "','" & Address & "')"<BR><BR> objCommand3 = New SqlCommand(strSQL, objConnection3)<BR><BR><BR><BR>please help<BR>It seems to me you would be better off writing a stored procedure. Then you simply pass it all the values, and do a check for an existing record in the SProc.as i have my reasons behind itUse a DataReader and check to see if you got any records in that.Just out of curiosity, why would one ever not want to use a SProc?
 
Top