| | |
MDB2 SQL Connection
Thread Solved |
Hi,
do anybody knows how to connect in sql mdb2 in Visual Basic 6
I only know how to connect in php...
this is my sample connection in php....
#======================================#
$mdb2 = connectdb();
$sql = "SELECT <fieldname> FROM <tablename>"
$results = selquery($sql,$mdb2);
closedb($mdb2);
#======================================#
do anyone knows how to do it in Visual Basic 6....
Please help me....
do anybody knows how to connect in sql mdb2 in Visual Basic 6
I only know how to connect in php...
this is my sample connection in php....
#======================================#
$mdb2 = connectdb();
$sql = "SELECT <fieldname> FROM <tablename>"
$results = selquery($sql,$mdb2);
closedb($mdb2);
#======================================#
do anyone knows how to do it in Visual Basic 6....
Please help me....
Hi,
Create a ODBC.
Add References to ur project "Microsoft ActiveX Data Objects 2.0 Library" (or any latest Version if u have)
In MDI Form Load :
Dim ad as ADODB.Connectionset ad=New ADODB.ConnectionLet ad.ConnectionString= "MyODBC;DSN=" & DatabaseName & ";UID=" & UserName & ";PWD=" & UserPasswordad.Open
To Get records from the Database use
dim ar as ADODB.recordsetset ar=new adodb.recordsetar.open "Select * From EmpMas Order By ENo"If Not (ar.EOF And ar.BOF) Thenar.MoveFirstdo while not ar.EOF Debug.Print ar("ENo") ar.movenextloopTo execute an SQL Statement :
ad.Execute "Update EmpMas Set EName ='MyName' Where ENo=1"
I Hope it is clear.
Regards
Veena
Create a ODBC.
Add References to ur project "Microsoft ActiveX Data Objects 2.0 Library" (or any latest Version if u have)
In MDI Form Load :
Dim ad as ADODB.Connectionset ad=New ADODB.ConnectionLet ad.ConnectionString= "MyODBC;DSN=" & DatabaseName & ";UID=" & UserName & ";PWD=" & UserPasswordad.Open
To Get records from the Database use
dim ar as ADODB.recordsetset ar=new adodb.recordsetar.open "Select * From EmpMas Order By ENo"If Not (ar.EOF And ar.BOF) Thenar.MoveFirstdo while not ar.EOF Debug.Print ar("ENo") ar.movenextloopTo execute an SQL Statement :
ad.Execute "Update EmpMas Set EName ='MyName' Where ENo=1"
I Hope it is clear.
Regards
Veena
Sorry after posting i saw, it was not readable.
Create a ODBC.
Add References to ur project "Microsoft ActiveX Data Objects 2.0 Library" (or any latest Version if u have)
In MDI Form Load :
Dim ad as ADODB.Connection
set ad=New ADODB.Connection
Let ad.ConnectionString= "MyODBC;DSN=" & DatabaseName & ";UID=" & UserName & ";PWD=" & UserPassword
ad.Open
To Get records from the Database use
dim ar as ADODB.recordset
Set ar=new adodb.recordset
ar.open "Select * From EmpMas Order By ENo"
If Not (ar.EOF And ar.BOF) Then
ar.MoveFirst
do while not ar.EOF
Debug.Print ar("ENo")
ar.movenext
loop
End If
To execute an SQL Statement :
ad.Execute "Update EmpMas Set EName ='MyName' Where ENo=1"
I Hope it is clear.
Regards
Veena
Create a ODBC.
Add References to ur project "Microsoft ActiveX Data Objects 2.0 Library" (or any latest Version if u have)
In MDI Form Load :
Dim ad as ADODB.Connection
set ad=New ADODB.Connection
Let ad.ConnectionString= "MyODBC;DSN=" & DatabaseName & ";UID=" & UserName & ";PWD=" & UserPassword
ad.Open
To Get records from the Database use
dim ar as ADODB.recordset
Set ar=new adodb.recordset
ar.open "Select * From EmpMas Order By ENo"
If Not (ar.EOF And ar.BOF) Then
ar.MoveFirst
do while not ar.EOF
Debug.Print ar("ENo")
ar.movenext
loop
End If
To execute an SQL Statement :
ad.Execute "Update EmpMas Set EName ='MyName' Where ENo=1"
I Hope it is clear.
Regards
Veena
Hi,
Sorry I thought it was already running in sql connection, it was the other program using Microsoft Access is the one is running...
I'm still having a runtime error like this:
Runtime error '3709'
when I click debug it is pointing on
I dont know how to solve it.
Regards,
Millan
Sorry I thought it was already running in sql connection, it was the other program using Microsoft Access is the one is running...
I'm still having a runtime error like this:
Runtime error '3709'
when I click debug it is pointing on
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
ar.Open "SELECT editorname FROM editormaster"
I dont know how to solve it.
Regards,
Millan
Last edited by millanskie; Dec 8th, 2006 at 5:29 am. Reason: edit the error msg
![]() |
Similar Threads
- direct remote sql connection (Visual Basic 4 / 5 / 6)
- Mdb2 Sql Connection (C)
- HOWTO: Share an SQL Connection between multiple forms within the same project (C#)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: Call Fox Pro Program
- Next Thread: Is it possible to VB6 program download into 68HC11 microcontroller?
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age application basic beginner birth bmp calculator cd cells.find click client code college component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report save search sendbyte sites sort sql sql2008 sqlserver subroutine tags textbox time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows





