Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
cusoxty
Constraint Violating Yak Guru
271 Posts |
Posted - 2004-06-10 : 12:20:45
|
I am trying to get these three different stored procedures to execute and enter data into the same record. It works, but each sql statement creates a new record, so account info, fromterritory info and toterritory info are in their own rows. Can anyone help me figure this out??[Code]Sub InsertData()dim sql1 = "insertaccounttransfermike '" & AccNumber.SelectedItem.Value & "'"dim sql2 = "insertaccounttransfermikefrom '" & FromName.SelectedItem.Value & "'"dim sql3 = "insertaccounttransfermiketo '" & ToName.SelectedItem.Value & "'"' Create Connection Object, Command Object, Connect to the databaseDim conn as New SQLConnection(connstr)Dim cmd1 as New SQLCommand(sql1,conn)Dim cmd2 as New SQLCommand(sql2,conn)Dim cmd3 as New SQLCommand(sql3,conn)conn.open()cmd1.ExecuteNonQuery()cmd2.ExecuteNonQuery()cmd3.ExecuteNonQuery()conn.Close()' go to the datagrid query pageResponse.redirect(return_page)[/Code]Is it something i need to change in the stored procedures, or what?? I would appreciate any help. |
|
timmy
Master Smack Fu Yak Hacker
1242 Posts |
Posted - 2004-06-10 : 19:35:47
|
Each of the SP's should check for the existence of the record. If it's there, UPDATE it. If it's not, INSERT a new record.Can you post the SP code? |
 |
|
|
|
|