In my project I used a datagrid and Adodc.datasource of datagrid is Adodc.there in Adodc properties I select "use connection string".I used Microsoft jet 4.0 OLE DB provider and select the connection path to the database as "F:\project\super.mdb".

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:\project\super.mdb
the path sould be valid when runing the program in another computer too.

I made the setup file and install it.when Im runing the program the datagrid is not work.it says the path "F:\project\super.mdb" is invalid.how can I solve this problem.help me please.

Rather use you adodb to connect to your database.

Once you have the connection open and you selected and opened a recordset, just set the datgrid's datasource to the recordset -

con.Open ...... F:/super.mdb....

rs.Open "SELECT * FROM .....

Set mshFlexgrid1.DataSource = rs

All records that has been selected will now ppopulate in your grid.

When the database is local on the user's computer, you can build the connection string to concatenate with the App.Path object property. When the database is on a shared network folder, you have to either a) make sure the same drive letter mapping is on every computer that's going to run your program, or b) use the Universal Naming Convention (UNC) format. Here's an example of that:

' using the Universal Naming Convention (UNC) name for the shared network folder
myConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\NetworkServer\SharedFolder\super.mdb"

If you use the UNC format for the file location, just be sure the users have the necessary permissions to the folder.

Hope this helps! Good luck!

what I want is to show the records in datagrid when form load.so please give me full code for that.Im not good in vb6.so please help.

Private Sub Form_Load()

endsub

As you had your code in the previous thread...

Dim cnCheck As ADODB.Connection
Set cnCheck = New ADODB.Connection
Dim rsCheck As ADODB.Recordset
Set rsCheck = New ADODB.Recordset

cnCheck.Open "provider = microsoft.jet.oledb.4.0;persist security info=false;data source = " & App.Path & "\MyDatabaseNameHere.mdb"

cnCheck.CursorLocation = adUseClient

rsCheck.Open "SELECT * FROM yourtablenamehere WHERE id=" & txtid.text & "'", cnCheck, adOpenDynamic, adLockPessimistic

If rsCheck.BOF = True Or rsCheck.EOF = True Then
    ''no records found...
        else
    Set mshFlexgrid1.Datasource = rsCheck
end if

Change the database, recordset and table names... also, you will probably need to change "id" as well as txtid.

con.Open ...... F:/super.mdb....
rs.Open "SELECT * FROM .....
Set mshFlexgrid1.DataSource = rs

I don't undestand with this code.please help me.

Did you see my code sample above? That works 100%... :)

I don't know for what Id and txtid.text is used for.but when i remove that part it works well.but there datagrid only displaying the records.tha arrow cannot be moved using adodc control.can I do that too

If you do not know what the id etc is for, it mens you are in the beginning stages of coding. Read up a bit on how to use the datacontyrol and grid together at THIS link. To go to the next page, change the "Smiley017" to "Smiley018" etc. for the next page...

Hope this helped.

Your question

tha arrow cannot be moved using adodc control.can I do that too

is a whole new thread (again :) ) to ask. Your question here on how to connect to grid was answered. Open a new thread, mark this as solved and I'll see if I can help some more.

thank you very much my friend.yes you are correct.Im very new to vb6 and in last month I started to learn it.you are a great help for me.thanks for the pdf files.oh yeah yeah..it's new thread again :)) .I will start it.

Cool man, will always help where I can. :)

See you in your new thread...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.