So i have tried basically 30 different methods of going about this all with different errors in every form and fashion. Basically all im trying to do is write to my database in some form or fashon. Im having no problems reading from it but i need to change some values in some places and i have fought it six ways to sunday to no avail.
My code is a total cluster right now but heres one of the methods ive tried. BTW this is VB.net on Vis studio 2010 using access 2007 .accdb database.
'con.ConnectionString = "Data Source=10.10.0.25;Initial Catalog=RConditions;Persist Security Info=True;User ID=mbish;Password=mbish" 'con.Open() ' con.ConnectionString = Provider2 & DataSource2 ' con.Open() ' upcommand = ' upcommand.Connection = (con) ' upcommand.CommandText = "update [Employee Table] SET [On a Job] =0 where [Employee ID] = '101')" ' upcommand.ExecuteNonQuery()
Dim OLECon As New OleDb.OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source = TimeClock.mdb") Dim OLECmd As New OleDb.OleDbCommand Dim OLEStr As String OLEStr = "UPDATE [Employee Table] SET" OLEStr += " On a Job = '" & ds.Tables("BigTable").Rows(employeeindex).Item(4) & "'" OLECmd = New OleDb.OleDbCommand(OLEStr, OLECon) OLECon.Open() OLECmd.ExecuteNonQuery() OLECon.Close()
I have found various ways of doing this on this site but none have worked for my situation for some reason or another.
Basically ive pulled down data from the database into this: "BigTable" and am able to access it perfectly but i need to modify a cell or two in the database and send it back up thus the "ds.Tables("BigTable").Rows(employeeindex).Item(4)" thing and its FUBARed.
Thanks in advance! You guys have been a great help over the years. Maybe if i one day feel confident in my coding Ide throw some advice around here as well.