This is Salami Quadri
Ado programming is just a simple thing, the following steps are to be taking
1. click on project in the menu bar
2. select Component from the drop down menu
3.Microsoft ADO data control 4.0
Then click ok
4. Click on apply and ok
The control is added to the tool box, double click on it to place the control on the form
Change the name and other properties like
DatabaseName click on ... displayed at the right corner of this property to browse the name.
Dim objConn as ADODB.Connection
Dim objRst as ADODB.Recordset
Dim lngRecordCount as Long
Set objConn = New ADODB.Connection
Set objRst = objConn.Execute("[SQL]", lngRecordCount)
Remember to set the connection string and SQL to what you actually want
I am astonished to find too many people asking the question of connectivity of database and vb.
First try to understand the properties of a connection object. You tell your ADO which database you want to contact, supply your user name and password (so the DBMS can grant you access to the database) and allow you to read,modify etc as per the previlages set for your user name. Actually the connection object is the gateway to any database.
If you open a code window of a new data project (EXE project you should have added a reference to the ADODB library) you can declare a connection object as follows:
Dim myConnection AS ADODB.Connection.
The moment you finish typing the dot(period) after the ADODB, you can see a vast list of objects with the ADO component, and you can select the one you want by the arrow keys. Declare the myConnection Object in the Code modules's declaration section. Then place the command button on the Form, name it myAccess Connection, and in the click event enter the following:
"provider=Microsoft.Jet.OLEDB.4.0;" & _
"Persist Security Info=False;" & _
"Data Source = C:\Program Files\VB98\Nwind.mdb"
The ampersand if you are using, kindly give a space before and after.
This will establish for you a connection to ACCESS NWind Database in the path shown by Data Source = c:\.....
If you want to know more please ask in the thread.
thanx fr ur help......but a problem is still there
Dim dbUserName As ADODB.Connection
Dim rsUserName As ADODB.Recordset
Set dbUserName = New ADODB.Connection
Set rsUserName = dbUserName.Execute("Select * from table ")
Do Until rsUserName.EOF
CboPassword.ItemData(CboPassword.NewIndex) = rsUserName("Serialno")
CboUserName.ItemData(CboUserName.NewIndex) = rsUserName("Serialno")
in the above code db1 is my database name for which i hv already created the user dsn....CboUserName and CboPassword are the two comboboxes that i hv used in my form
when i compile this code in the form load event ....it is giving an error in the "from clause" of the SQL statement...
Please confirm by return post whether you are connecting to Access Db or MsSql Server version of the database. Then only your problem can be solved.
By the time I am writing the code for you for a cut and paste on the thread.
thanx....the problem is solved now.....it ws a connection problem only.....
i need 1 another help ....how can i encrypt my database.....
nd then how can i access that encryptd database from VB....
will i hv to decrypt it for accessing it.....nd if yes then how do i decrypt it also in VB