Need OLEDB Connect String Example for Sybase

G

Guest

I need to use OLEDB Provider to access Sybase. I am having problems with the
ASE provider and prefer OLEDB.

Question: What do I need to implement that? Any clients to install?

A working example would be appreciated.
 
G

Guest

Kerry, I'm sorry but your code didn't work.
Here's the error message:

Message: No value given for one or more required parameters.
System.Data.Oledb.OLEdbException
Source: Micrsoft Jet Database Engine at
System.Data.OledbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS
dbParams, Object&ExecuteResult)
.....
at System.data.common.dbdataadater.fillInternal(DataSet dataset, DataTable
datatables, int32StartRecord,\Int32 MaxRecords....


at system.data.common.dbdataadapter.fill(datatable datatable)
line 404

dAdapter.Fill(dTable)


Here's the code I adapted from you:

Dim cnstring As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=|DataDirectory|\HasbaraSample.mdb;Persist Security Info=True"
Dim cn As New OleDbConnection(cnstring)
Dim cmd As New OleDb.OleDbCommand
Dim dAdapter As New OleDb.OleDbDataAdapter
Dim dTable As New DataTable

cmd.CommandText = "Select LastName + ', ' + FirstName As
AuthorName, ID From Authors2 Order By AuthorName"
cnAC.Open()
cmd.Connection = cn
dAdapter.SelectCommand = cmd
Me.lstAuthors.DisplayMember = "AuthorName"
lstAuthors.ValueMember = "ID"
lstAuthors.DataSource = dTable
dAdapter.Fill(dTable)

cn.Close()

If the lstAuthors statements are placed after the cn.close, I get the same
error.

dennist685
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top