December 1st, 2012, 12:13 AM
Data in Datagrid appear and then disappear.
I have a vb application which search for records in a table based on another table. The table analysis contain multiple record,the table man_tmp should display records based on the ana_id field. When i run the code I see the records in the datagrid but it disappear instantly.Can anyone help please. Here are my code.thnx.
Dim cn2 As New ADODB.Connection
Dim rs1 As New ADODB.Recordset
Set cn2 = New ADODB.Connection
cn2.ConnectionString = MDI1.txtcn
rs1.Open "select ana_id from analysis where ana_name = 'analysis1'", cn1, adOpenStatic, adLockPessimistic
Do While Not rs1.EOF
Adodc1.ConnectionString = MDI1.txtcn
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = "select * from man_tmp with(nolock)where description like '%" & rs1.Fields("ana_id") & "%'"
Set DataGrid1.DataSource = Adodc1
rc.Text = Adodc1.Recordset.RecordCount
If Not rs1.EOF Then
Tags for this Thread
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.