none
SlotAdapter.Fill(ds, "stud") in this line exception throws.pls help fast. RRS feed

  • Question


  •     Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
            sql = "SELECT * FROM stud WHERE name = '" & TextBox1.Text & "'"
            SlotAdapter = New OleDb.OleDbDataAdapter(sql, con)
            SlotAdapter.Fill(ds, "stud")
            Dim TblSlot As DataTable
            TblSlot = ds.Tables("stud")
            If ds.Tables(0).Rows.Count > 0 Then
                SlotAdapter.UpdateCommand = New OleDb.OleDbCommand
                SlotAdapter.UpdateCommand.Connection = con
                SlotAdapter.UpdateCommand.CommandText = "UPDATE stud SET roll='" + TextBox2.Text + "', add='" + TextBox3.Text + "',Id='" + TextBox4.Text + " WHERE name='" + TextBox1.Text + "'"
                SlotAdapter.Update(TblSlot)
            Else
                MessageBox.Show("The Item No just Entered Does Not exist Please Try Again", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning)
            End If
        End Sub
    Sunday, May 1, 2011 6:14 AM

All replies

  • Hi Racha,

    Welcome to the MSDN fourm.

    Base on you description. There are something to confirm.

    1、 Is the database connection string right? Does the user has the login permission?

    2、 Does the sql connectionn opened before get retrive the datas.

    OledbConnection conn=new OledbConnection(connString);

    conn.Open();

    ...

    conn.Close();

    I hope that would be help you. Is there any issue please let me know and  paste the total exception informations.

    Best Regards.


    If it's helpful for you, Please vote or mark. Thank you!

    David Peng [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.



    Monday, May 2, 2011 6:41 AM
    Moderator
  • What kind of exception message do you receieve?
    Val Mazur (MVP)

    http://www.xporttools.net


    Monday, May 2, 2011 10:18 AM
    Moderator