![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
. Reply (E-mail) Forward (E-mail) Subject: Add row, ODBC and ADO.NET From: "Marcus Olsson" <nospam (AT) nospam (DOT) se> Sent: 9/1/2003 8:08:17 AM Hi! I have a beginner problem and hope that someone easily can solve my problem. I want to connect to my Access database with ODBC. I have downloaded MS ODBC library for connection with ODBC from .NET. It looks like I get the data and able to add the row, but when I should update the source with the new data it doesn't work. Can you please give me a good link or tell me what's wrong below. Please help! [snip] |
#3
| |||
| |||
|
|
On Mon, 1 Sep 2003 08:42:41 -0700, "Marcus Olsson" <nospam (AT) nospam (DOT) se wrote: . Reply (E-mail) Forward (E-mail) Subject: Add row, ODBC and ADO.NET From: "Marcus Olsson" <nospam (AT) nospam (DOT) se> Sent: 9/1/2003 8:08:17 AM Hi! I have a beginner problem and hope that someone easily can solve my problem. I want to connect to my Access database with ODBC. I have downloaded MS ODBC library for connection with ODBC from .NET. It looks like I get the data and able to add the row, but when I should update the source with the new data it doesn't work. Can you please give me a good link or tell me what's wrong below. Please help! [snip] Take a look at the OdbcCommandBuilder Class in the ODBC.NET help file. Here is the sample code from that page. Chris -------------- Public Function SelectOdbcSrvRows(myDataSet As DataSet,myConnection As _ String, mySelectQuery As String, myTableName As String) As DataSet Dim myConn As New OdbcConnection(myConnection) Dim myDataAdapter As New OdbcDataAdapter() myDataAdapter.SelectCommand = New OdbcCommand(mySelectQuery, myConn) ' ** You're missing this next line ** Dim custCB As OdbcCommandBuilder = New OdbcCommandBuilder(myDataAdapter) myConn.Open() Dim custDS As DataSet = New DataSet myDataAdapter.Fill(custDS, "Customers") ' Code to modify data in DataSet here ' Without the OdbcCommandBuilder this line would fail. myDataAdapter.Update(custDS, "Customers") myConn.Close() SelectOdbcSrvRows = custDS End Function 'SelectOdbcSrvRows |
#4
| |||
| |||
|
|
Hil. And I have very interesting problem. I install ODBC for NET, but ditective Imports System.Data..... do not view odbc library. "Chris W." <GuamChris (AT) No (DOT) Spam.Yahoo.Com> wrote in message news:20c8lvs3chcdsv7si8to5t8csk8jkh3fkj (AT) 4ax (DOT) com... On Mon, 1 Sep 2003 08:42:41 -0700, "Marcus Olsson" <nospam (AT) nospam (DOT) se wrote: . Reply (E-mail) Forward (E-mail) Subject: Add row, ODBC and ADO.NET From: "Marcus Olsson" <nospam (AT) nospam (DOT) se> Sent: 9/1/2003 8:08:17 AM Hi! I have a beginner problem and hope that someone easily can solve my problem. I want to connect to my Access database with ODBC. I have downloaded MS ODBC library for connection with ODBC from .NET. It looks like I get the data and able to add the row, but when I should update the source with the new data it doesn't work. Can you please give me a good link or tell me what's wrong below. Please help! [snip] Take a look at the OdbcCommandBuilder Class in the ODBC.NET help file. Here is the sample code from that page. Chris -------------- Public Function SelectOdbcSrvRows(myDataSet As DataSet,myConnection As _ String, mySelectQuery As String, myTableName As String) As DataSet Dim myConn As New OdbcConnection(myConnection) Dim myDataAdapter As New OdbcDataAdapter() myDataAdapter.SelectCommand = New OdbcCommand(mySelectQuery, myConn) ' ** You're missing this next line ** Dim custCB As OdbcCommandBuilder = New OdbcCommandBuilder(myDataAdapter) myConn.Open() Dim custDS As DataSet = New DataSet myDataAdapter.Fill(custDS, "Customers") ' Code to modify data in DataSet here ' Without the OdbcCommandBuilder this line would fail. myDataAdapter.Update(custDS, "Customers") myConn.Close() SelectOdbcSrvRows = custDS End Function 'SelectOdbcSrvRows |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |