![]() |
Click here to advertise with us
|
|
|||||||
| ADO.NET Anything regarding DataAdapters, DataReaders, DataSets, etc. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Hey Community,
I have done some vb.net courses in school, however none with database or getting into inheritance etc. I specialized in System Admin. I now have the need to create an application that extracts data from our ERP software. The software uses CISAM files and we have Transoft ODBC connections available to the data. I'm lost on how to access this data. I'm using MS VB 2008 Express edition. I recently downloaded and installed the references found here (How to use the ODBC .NET Managed Provider in Visual Basic .NET and connection strings) on how to make an ODBC connection. I have created a button that does the following successfully, which displays the first record in a row - I terminate the app to stop it. Code:
Dim conn As OdbcConnection
Dim connectionString As String
Dim comm As OdbcCommand
Dim dr As OdbcDataReader
Dim sqlStr As String
connectionString = "dsn=Encore50A;uid=;pwd=;"
conn = New OdbcConnection(connectionString)
sqlStr = "Select * from INVPRICE"
conn.Open()
comm = New OdbcCommand(sqlStr, conn)
dr = comm.ExecuteReader()
While (dr.Read())
MsgBox(dr.GetValue(0).ToString())
End While
conn.Close()
dr.Close()
comm.Dispose()
conn.Dispose()
End Sub
a) A good resource with examples so I can understand how this works b) Showi me how to display the data in a DataGrid - with/without the ability to modify. c) Figure out how (via programming) to copy tables from this odbc connection to a local MDB file. Feel free to lead me to water, I can attempt to drink and come back with more questions
Last edited by cathalo; 03-30-2009 at 10:04 AM. Reason: Spelling / Category |
|
|||
|
Good to see the message has been read, no replies.
I've progressed a little - I have found some code (however I don't completely understand it) that creates an Access DB. Code:
Public Function CreateAccessDatabase( _
ByVal DatabaseFullPath As String) As Boolean
Dim bAns As Boolean
Dim cat As New ADOX.Catalog()
Try
'Make sure the folder
'provided in the path exists. If file name w/o path
'is specified, the database will be created in your
'application folder.
Dim sCreateString As String
sCreateString = _
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
DatabaseFullPath
cat.Create(sCreateString)
bAns = True
Catch Excep As System.Runtime.InteropServices.COMException
bAns = False
'do whatever else you need to do here, log,
'msgbox etc.
Finally
cat = Nothing
End Try
Return bAns
End Function
I will keep digging. |
|
|||
|
I receive this message when attempting the code listed below.
Any ideas on this one? ERROR [IM001] [Microsoft][ODBC Driver Manager] Driver does not support this function Code:
Dim cn As New OdbcConnection("dsn=Encore50A;uid=;pwd=;")
Dim cmd As OdbcCommand
Dim adp As OdbcDataAdapter
Dim ds As New DataSet
cn.Open()
cmd = New OdbcCommand("select * from INVPRICE", cn)
adp = New OdbcDataAdapter(cmd)
adp.Fill(ds, "StockCode")
Me.DataGridView1.DataSource = ds
Me.DataGridView1.DataMember = "StockCode"
'MsgBox(cn.State.ToString)
cn.Close()
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|