mr relaxo Posted August 17, 2003 Posted August 17, 2003 Hi,Im trying to do an insert to the database with a dataset that has been merged with another dataset containing the new record i want to write. The merge works no problem but the database isnt updated. the code works for tables without any primary keys but causes a constraint violation for a table with a primary key. Here is the code for the insert function: Public Function dsinserter(ByRef ds As DataSet, ByVal strsql As String, ByVal xds As DataSet) As Boolean Dim objconn As New OdbcConnection(getconstring) Dim objadapter As New OdbcDataAdapter(strsql, objconn) Dim cb As New OdbcCommandBuilder(objadapter) Try objadapter.AcceptChangesDuringFill = False objadapter.Fill(xds, "details") xds.Merge(ds.Tables("details"), false, MissingschemaAction.Ignore) objadapter.Update(xds.Tables("details")) Return True Catch e As Exception msLastError = e.Message Return False End Try End Function Ive done alot of searching for answers but without any luck. Any ideas on how i can get this to work with a table which has a primary key? Thank you. Quote You can not get ye flask.
mr relaxo Posted August 18, 2003 Author Posted August 18, 2003 ok nevermind, i didnt really need to merge them in the first place. :D Quote You can not get ye flask.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.