0

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
2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by ramesh017
0

>but its not displaying any data from database.

Use * instead of %.

cm.CommandText = "select * from (" & tbl_name & ") where Start_loc like '" & form.ListBox_Fielddetails.SelectedItem & "*'"

Edited by __avd: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.