0

Dear Colleague:

How can I use "begin transaction", "commit transaction", "rollback transaction" and the like in the visual basic 6. Is it possible to populate a combobox in VB form with the data that is retrieved from SQL server database table? How the code looks like?

regards,

benyam

2
Contributors
3
Replies
5
Views
11 Years
Discussion Span
Last Post by aparnesh
0

The workspace object has the begin/commit/rollback trans options (For Jet). If u r using SQL server, it will depend on how u r connecting to the database (ODBC, ADO, etc).

To populate a combo box from a recordset from SQL server db, simply use

Do until rs.eof
  combo1.additem rs("FieldName")
  rs.movenext
Loop
0

Dear colleague,

Thanks for the help, I have used it. I use ADO. But what is a workspace? is that an object that helps to make the software works in the netwrok. Pleae give me some ideas about. An one more question. is it possible to populate the combobox with a query result? How?

regards,

ben

0

Workspace is an object in DAO Object Library. I have used to for accessing Access Databases using Jet. The syntax is something like

Dim ws as workspace
set ws = dbengine.workspaces(0)
Dim db as database
set db = ws.opendatabase(...)

etc


For query results to combo box, the code in my last post would work fine. If u r using ADO,

Dim rs as ADODB.Recordset
Dim objCmd as ADODB.Command

< Code to specify Query to execute >
set rs = objCmd.Execute()

And now u can use
do until rs.eof
....
loop
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.