Deleting entry from table using ODBC - please help 
Author Message
 Deleting entry from table using ODBC - please help

I am trying to delete an entry from a table using ODBC in VB.NET.  I can read
data into my dataset with no problem but I can't make a delete work.

Below is what I'm doing for a read (I've left out the information on connecting
to the data source, etc.).  It works fine.  I tried to do a .Delete on the
dataset row that is returned, to set the .DeleteCommand on the daODBC variable,
and then do a .Update on the daODBC variable.  This returned a system error.
If someone could help me understand what needs to be done to delete the one row
that is returned (in the database, not the datatable variable), I would really
appreciate it.  Thank you.

    Dim daODBC As New OdbcDataAdapter()
    Dim dtItems As DataTable
    Dim mcnData As OdbcConnection
    Dim ocODBC As New OdbcCommand()
    Dim sSQLCommand As String

    mcnData = New OdbcConnection()

    mcnData.ConnectionString = sODBCConnectionString
    mcnData.Open()

    sSQLCommand = "SELECT Field1, Field2 FROM MyTable WHERE Field1 = 5"

    ocODBC.Connection = mcnData
    ocODBC.CommandText = sSQLCommand
    daODBC.SelectCommand = ocODBC

    dtItems = New DataTable()

    daODBC.Fill(dtItems)

    If (dtItems.Rows.Count > 0) Then
    End If



Fri, 11 Feb 2005 22:39:03 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. need help please:joined tables,add new entries based on one table columns

2. need help please:joined tables,add new entries based on one table columns

3. ODBC error when using SQL delete from dBase table

4. ODBC error when using SQL delete from dBase table

5. PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP,

6. Please help,how do I search for one entry in a dynamic array using random access

7. delete table entry by date

8. Delete all the entries of a table

9. Delete all the entries of a table

10. Delete all the entries of a table

11. ODBC Connect for Tables with 200.000 entries

12. Changing Servers/Tables using ODBC ----- <HELP!>

 

 
Powered by phpBB® Forum Software