![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | INSERT Problem This is driving me crazy ... I have a typed dataset that I created using VS2008. I created an Insert statement: "INSERT INTO x (v1, v2, v3, ..., vN) VALUES (?, ?, ?, ... N?)" Then I add parameters to the Insert command (OleDbCommand BTW, going into an Access database): myOldDbCommandInsert.Parameters.Add(new OleDbParameter("columnName", OleDbType.DBTimeStamp)); myOldDbCommandInsert.Parameters.Add(new OleDbParameter("columnName2", OleDbType.Char)); .... myOldDbCommandInsert.Parameters.Add(new OleDbParameter("columnNameN", OleDbType.UnsignedInt)); Now I set my default values: myOldDbCommandInsert.Parameters["c1"].Value = defaultValue1; myOldDbCommandInsert.Parameters["c2"].Value = defaultValue2; .... myOldDbCommandInsert.Parameters["cN"].Value = defaultValueN; Then I create my data adapter: OleDbDataAdapter a = new OleDbDataAdapter("SELECT * FROM x", myConn); Then the dataset: MyCustomDataSet ds = new MyCustomDataSet(); a.Fill(ds.MyCustomTable); So far, everything has worked fine up until this point. So now, I simply want to add rows to MyCustomTable: SomeLoopWith5ValuesOrWhatever { MyCustomDataSet.MyCustomRowA r = (cast) MyCustomDataSet.MyCustomTable.NewRow(); r.v1 = x; r.v2 = y; r.v3 = z; r.nN = N; myDataSet.myDataTable.Rows.Add(r); } Stepping through the debugger, that appears to do exactly what I expect. I can see that the table gets the new rows, and they have the correct values. However, when I do the following: myDataAdapter.Update(myDataSet, "NameOfCorrectTable"); The correct number of rows are added to the correct table, but they do not have the new values?!! They are keeping the default values that I set earlier in my code. Why is my INSERT statement using these default values? It's been a while since I messed with database stuff. Thanks. |
My System Specs![]() |
| | #2 (permalink) |
| | Re: INSERT Problem Tom wrote: Quote: > This is driving me crazy ... > > I have a typed dataset that I created using VS2008. I created an > Insert statement: > of the previous questions in this newsgroup before posting yours - always a recommended practice) , but this is a classic (COM-based) ADO newsgroup. ADO.Net bears very little resemblance to classic ADO so, while you may be lucky enough to find a dotnet-knowledgeable person here who can answer your question, you can eliminate the luck factor by posting your question to a group where those dotnet-knowledgeable people hang out. I suggest microsoft.public.dotnet.framework.adonet. Oops, I've just noticed you crossposted to several groups. I'm replying from the data.ado group.The only relevant group you chose was the dotnet group. They might be able to help you there. if not, try the adonet group. -- Microsoft MVP - ASP/ASP.NET Please reply to the newsgroup. This email account is my spam trap so I don't check it very often. If you must reply off-line, then remove the "NO SPAM" |
My System Specs![]() |
| | #3 (permalink) |
| | Re: INSERT Problem Thanks Bob. I've since posted to the adonet newsgroup. "Bob Barrows [MVP]" <reb01501@xxxxxx> wrote in message news:ugIUHxbsIHA.1768@xxxxxx Quote: > Tom wrote: Quote: >> This is driving me crazy ... >> >> I have a typed dataset that I created using VS2008. I created an >> Insert statement: >> > of the previous questions in this newsgroup before posting yours - always > a > recommended practice) , but this is a classic (COM-based) ADO newsgroup. > ADO.Net bears very little resemblance to classic ADO so, while you may be > lucky enough to find a dotnet-knowledgeable person here who can answer > your > question, you can eliminate the luck factor by posting your question to a > group where those dotnet-knowledgeable people hang out. I suggest > microsoft.public.dotnet.framework.adonet. > > Oops, I've just noticed you crossposted to several groups. I'm replying > from the data.ado group.The only relevant group you chose was the dotnet > group. They might be able to help you there. if not, try the adonet group. > > -- > Microsoft MVP - ASP/ASP.NET > Please reply to the newsgroup. This email account is my spam trap so I > don't check it very often. If you must reply off-line, then remove the > "NO SPAM" > |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| SATA problem? "Please insert disc in drive D:" | General Discussion | |||
| how to insert pic? | Live Mail | |||
| insert cd | Vista music pictures video | |||
| CD Insert/Jewel Case Insert Maker ignored? | Vista music pictures video | |||
| Halflife 2 and Halflife 2 Episode One, insert disc problem before I even installed! | Vista Games | |||