![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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) |
| | database wont update D wrote: Quote: > I am trying to add records to a database and getting no errors but the > databse is not updated. > Not sure what is wrong maybe in my function I'm losing some thing? > What do you think? My code is below. > Quote: > OdbcConnection dbconn = new > OdbcConnection("Provider=MSDASQL.1;DRIVER={Microsoft Access Driver > (*.mdb)};DBQ=c:\\hedgefunds\\db1.mdb;DATABASE=db1;UID=root;PWD=; > OPTION=1;"); instead. SQL Server Express is free. So's SQL Server Compact Edition if you need the ability to exchange databases as files. Snarking aside, though... Quote: > public void UpdateinDB(DbDataAdapter dbrs, DataSet dbADOrs, > String[] fields) > { > DataTable dt = dbADOrs.Tables[0]; > DataRow rec = dt.NewRow(); > MessageBox.Show(dt.Columns[0].ToString()); > if (fields[0] != "fundname")//file has header so ignore it. > { > rec["name"] = fields[0]; > rec["date"] = fields[1]; > rec["corr"] = fields[2]; > > try > { > dbrs.Update(dbADOrs);//no update to the database occurs > here no exceptions triggered experience), but .NewRow() doesn't actually add a new row to the table, it just creates one based on the table's scheme. See http://msdn.microsoft.com/library/z16c79x4 for a sample. -- J. |
My System Specs![]() |
| | #2 (permalink) |
| | Re: database wont update D wrote: Quote: > I am trying to add records to a database and getting no errors but the > databse is not updated. > Not sure what is wrong maybe in my function I'm losing some thing? > What do you think? My code is below. > Quote: > OdbcConnection dbconn = new > OdbcConnection("Provider=MSDASQL.1;DRIVER={Microsoft Access Driver > (*.mdb)};DBQ=c:\\hedgefunds\\db1.mdb;DATABASE=db1;UID=root;PWD=; > OPTION=1;"); instead. SQL Server Express is free. So's SQL Server Compact Edition if you need the ability to exchange databases as files. Snarking aside, though... Quote: > public void UpdateinDB(DbDataAdapter dbrs, DataSet dbADOrs, > String[] fields) > { > DataTable dt = dbADOrs.Tables[0]; > DataRow rec = dt.NewRow(); > MessageBox.Show(dt.Columns[0].ToString()); > if (fields[0] != "fundname")//file has header so ignore it. > { > rec["name"] = fields[0]; > rec["date"] = fields[1]; > rec["corr"] = fields[2]; > > try > { > dbrs.Update(dbADOrs);//no update to the database occurs > here no exceptions triggered experience), but .NewRow() doesn't actually add a new row to the table, it just creates one based on the table's scheme. See http://msdn.microsoft.com/library/z16c79x4 for a sample. -- J. |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| My Vista Wont update | Vista security | |||
| Windows wont update! Limewire, BitComet wont connect!! | Network & Sharing | |||
| Works database 2007 and Office database 2003 | .NET General | |||
| Windows Update Wont Update! | Vista General | |||
| How long is it going to take MS to update their database so that the weather gadget works? | Vista General | |||