I have used this code. I keep getting an error at the line where i invoke the data adapter fill method for the second time, they state that i have not specified a parameter. But i see no difference between the 1st and 2nd time i invoke the fill method. Can anybody help me see wats wrong?
conStr = "Provider=Microsoft.JET.OLEDB.4.0;data source=MainDB.mdb"
conn = New OleDbConnection(conStr)
sqlStr = "SELECT * FROM LoginTable"
cmSQL = New OleDbCommand(sqlStr, conn)
cmSQL.CommandTimeout = 30
adapter = New OleDbDataAdapter(sqlStr, conn)
adapter.SelectCommand = cmSQL
ds = New DataSet()
adapter.Fill(ds, "LoginTable")
dt = New DataTable()
dt = ds.Tables(0)
numrows = dt.Rows.Count
Dim temp As String = dt.Rows(i).Item("Username")
Dim updateSQL As String = "UPDATE LoginTable SET Username = ? WHERE Username = ?"
cmSQL.CommandText = updateSQL
adapter.UpdateCommand() = New OleDbCommand(updateSQL, conn)
adapter.UpdateCommand.Parameters.Add("Username", OleDbType.VarWChar)
Dim workParm As OleDbParameter = adapter.UpdateCommand.Parameters.Add("Username", OleDbType.VarWChar)
workParm.SourceColumn() = "Username"
workParm.SourceVersion = DataRowVersion.Original
adapter.Fill(ds, "LoginTable")
oh yah, if i wanna post vb code in here, wat tags do i need to insert? so that nex time i can use it...
conStr = "Provider=Microsoft.JET.OLEDB.4.0;data source=MainDB.mdb"
conn = New OleDbConnection(conStr)
sqlStr = "SELECT * FROM LoginTable"
cmSQL = New OleDbCommand(sqlStr, conn)
cmSQL.CommandTimeout = 30
adapter = New OleDbDataAdapter(sqlStr, conn)
adapter.SelectCommand = cmSQL
ds = New DataSet()
adapter.Fill(ds, "LoginTable")
dt = New DataTable()
dt = ds.Tables(0)
numrows = dt.Rows.Count
Dim temp As String = dt.Rows(i).Item("Username")
Dim updateSQL As String = "UPDATE LoginTable SET Username = ? WHERE Username = ?"
cmSQL.CommandText = updateSQL
adapter.UpdateCommand() = New OleDbCommand(updateSQL, conn)
adapter.UpdateCommand.Parameters.Add("Username", OleDbType.VarWChar)
Dim workParm As OleDbParameter = adapter.UpdateCommand.Parameters.Add("Username", OleDbType.VarWChar)
workParm.SourceColumn() = "Username"
workParm.SourceVersion = DataRowVersion.Original
adapter.Fill(ds, "LoginTable")
oh yah, if i wanna post vb code in here, wat tags do i need to insert? so that nex time i can use it...