urgent!!!! plz help

vaiz

New member
Joined
Jun 19, 2004
Messages
4
Programming Experience
Beginner
hi
i have a problem while updating the dataadapter there are no errors but the data is not updated in the database
i am using multiple datasets generated grom the same dataadapter


i have the database in Access 2003

i have provided you with the code could u please check it out and let me know where im going wrong.

if u need any more information plz let me know



Private
Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim cnt, c1, sn1, n1, c2, l, val0, val1, val4 As Integer

Dim sn, v As Array

Dim anyRow As DataRow = DataSet181.Att.NewRow

Dim val2, val3 As String



OleDbDataAdapter2.SelectCommand.CommandText = "Select * from Att where S_ID =" & TextBox1.Text & " and A_Program='" & ComboBox2.Text & "' and A_Date is null"

DataSet191.Clear()

OleDbDataAdapter2.Fill(DataSet191)

cnt = DataSet191.Att.Rows.Count

If cnt <> 0 Then

OleDbDataAdapter2.SelectCommand.CommandText = "Select S_ID,A_Session,A_Date,A_Class,A_Fees,A_Program,A_Remarks,A_ID from Att where S_ID=" & Val(TextBox1.Text) & " and A_Program='" & ComboBox2.Text & "' and A_Date is null"

DataSet111.Clear()

OleDbDataAdapter2.Fill(DataSet111)

val0 = DataSet111.Att.Rows(0).Item(0)

val1 = DataSet111.Att.Rows(0).Item(1)

val2 = DataSet111.Att.Rows(0).Item(4)

val3 = DataSet111.Att.Rows(0).Item(5)

val4 = Val(DataSet111.Att.Rows(0).Item(7))

OleDbDataAdapter2.UpdateCommand.CommandText = "UPDATE Att SET S_ID =" & val0 & ", A_Session=" & val1 & ", A_Date='" & DateTimePicker1.Text & "', A_Class ='" & ComboBox1.Text & "', A_Program ='" & val2 & "', A_Fees ='" & val3 & "', A_Remarks ='" & TextBox3.Text & "' WHERE A_ID =" & val4



OleDbDataAdapter2.Update(DataSet191)

DataSet121.Clear()

OleDbDataAdapter2.SelectCommand.CommandText = "Select S_ID,A_Session,A_Date,A_Class,A_Fees,A_Program,A_Remarks,A_ID from Att where S_ID=" & Val(TextBox1.Text) & " and A_Program='" & ComboBox2.Text & "'"

OleDbDataAdapter2.Fill(DataSet121, "Att")

Else



DataSet171.Clear()

OleDbDataAdapter2.SelectCommand.CommandText = "Select A_Session from Att where S_ID =" & Val(TextBox1.Text) & " and A_Program ='" & ComboBox2.Text & "'"

DataSet171.Clear()

OleDbDataAdapter2.Fill(DataSet171)

c1 = DataSet171.Att.Rows.Count



c1 = c1 - 1

sn = DataSet171.Att.Rows(c1).ItemArray

sn1 = sn(1) + 1

anyRow("S_ID") = Val(TextBox1.Text)

anyRow("A_Session") = sn1

anyRow("A_Date") = DateTimePicker1.Text

anyRow("A_Class") = ComboBox1.Text

anyRow("A_Program") = ComboBox2.Text

DataSet181.Att.Rows.Add(anyRow)

OleDbDataAdapter2.InsertCommand.CommandText = "INSERT into Att(S_ID,A_Session,A_Date,A_Class,A_Program)VALUES(?,?,?,?,?)"

OleDbDataAdapter2.Update(DataSet181)

OleDbDataAdapter2.SelectCommand.CommandText = "Select S_ID,A_Session,A_Date,A_Class,A_Fees,A_Program From Att where S_ID =" & Val(TextBox1.Text) & " and A_Program ='" & ComboBox2.Text & "'"

DataSet121.Clear()

OleDbDataAdapter2.Fill(DataSet121)



End If



End Sub

 

vaiz

New member
Joined
Jun 19, 2004
Messages
4
Programming Experience
Beginner
solution found

hey ppl i finaaly found a solution to this problem
Thanx anyways guys
 

Neal

Forum Admin
Staff member
Joined
Jun 2, 2004
Messages
123
Location
VA
Programming Experience
10+
Please use more descriptive subject lines to identify your issue other then a plea for help.

Thank you.
 

Paszt

Staff member
Joined
Jun 3, 2004
Messages
1,500
Location
Raleigh, NC - USA
Programming Experience
Beginner
It would also be cool if you could post the solution, so others could benifit. :)
 
Top Bottom