Hi i tried the same.. but its not displaying any data from database
Public Class Editdetails
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim cn As New System.Data.OleDb.OleDbConnection
Dim cm As New System.Data.OleDb.OleDbCommand
Dim form As New Fielddetails
Dim rd As System.Data.OleDb.OleDbDataReader
Dim tbl_name As String = "Fld_detail_" & Datamaker.Application_Datamaker_ListBox.SelectedItem
cn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Documents and Settings\175943\Desktop\database1.accdb;Persist Security Info=False;"
Try
cn.Open()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
cm.Connection = cn
cm.CommandText = "select * from (" & tbl_name & ") where Start_loc like '" & form.ListBox_Fielddetails.SelectedItem & "%'"
rd = cm.ExecuteReader()
While rd.Read
Me.datatype.SelectedItem = rd("Datatype").ToString
Me.fieldname.Text = rd("Field_var").ToString
End While
rd.Close()
End Sub