Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi,

 

Have been given code to look through and to convert to SQL Server 2000. The project is currently linked to Access. The problem is with the following method...

 

Friend Function FillAbsentDataset(byval strAbs as string, byval strDSAbs as string, strSqlCC as string) as dataset

Dim daDataAdapter as oledbDataAdapter

dim dbconConnection as System.data.idbConnection = new oledbconnection(strConnectionString) 'strConnectionString is defined earlier

dim dsDataset as dataset

dsDataset = new dataset

daDataAdapter = new OledbDataAdapter(strSqlAbs, dbconConnection)

dbConnection.close()

End Function

 

Would i be correct in saying that the line

daDataAdapter = new OledbDataAdapter(strSqlAbs, dbConnection)

is basically saying that strSqlAbs is my select statement, and that the line is a quick way of executing the sql statement???

 

I usually execute a sql select statement by doing the following...

connect() 'My connection string

conSQL.open

commSQL.connection = conSQL

commSQL.commandType = CommandType.Text

commSQL.commandText = The select statement

daDataAdapter.selectcommand = commSQL

conSQL.close

 

Would appreciate any comments, on either piece of code.

 

Mike55

A Client refers to the person who incurs the development cost.

A Customer refers to the person that pays to use the product.

------

My software never has bugs. It just develops random features. (Mosabama vbforums.com)

  • *Experts*
Posted

In both cases you're not actually doing the Fill.

 

After you have "daDataAdapter = new OledbDataAdapter(strSqlAbs, dbconConnection)" you need to use daDataAdapter.Fill to fill a dataset based on your SELECT (or exec of a proc, etc.).

 

-ner

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...