Current location: Hot Scripts Forums » Programming Languages » ASP.NET » converting vb.net code into asp.net

converting vb.net code into asp.net

Reply
  #1 (permalink)  
Old
New Member
 
Join Date: Sep 2012
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
converting vb.net code into asp.net

I am trying to convert a vb.net code into asp.net that loads tables in combobx and displays selected table in datagridview .
i got 'DisplayMember is not member of System.Web.UI.dropdownlist and variable conflicts with property adapter during debug.
any help would be appriciated .
Code:
 Imports System.Data.OleDb
Public Class WebForm1
 Inherits System.Web.UI.Page
 
   
    Private con As New OleDbConnection("  Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\dtb.accdb;Jet OLEDB:Database Password=****  ")
    Private adapter As New OleDbDataAdapter(String.Empty, Me.con)
    Private data As DataTable
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        con.Open()
     
        Me.DropDownList1.DisplayMember = "TABLE_NAME"
        Me.DropDownList1.ValueMember = "TABLE_NAME"
        Me.DropDownList1.DataSource = Me.con.GetSchema("TABLES", New String() {Nothing, Nothing, Nothing, "TABLE"})
        con.Close()
    End Sub

   

    Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles DropDownList1.SelectedIndexChanged
        If Me.DropDownList1.SelectedItem IsNot Nothing Then
            Me.data = New DataTable
            Me.adapter.SelectCommand.CommandText = String.Format("SELECT * FROM [{0}]", Me.DropDownList1.SelectedValue)
            Me.adapter.Fill(data)
            Me.GridView1.DataSource = Nothing
            Me.GridView1.Columns.Clear()
            Me.GridView1.DataSource = Me.data
        End If
    End Sub
 
    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
        ' Dim thisConnection As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Dtb.accdb")

        If Me.data IsNot Nothing Then
            Dim builder As New OleDbCommandBuilder(Me.adapter)
            Me.adapter.Update(Me.data)
        End If
Reply With Quote

Featured Marketplace Scripts (view more)

Reply

Bookmarks

Tags
asp.net


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Code for reading a text file xDreamer PHP 7 06-09-11 01:22 AM
PHP Code Deployment Tips danieljames123 PHP 0 06-08-11 12:23 AM
PHP inside JavaScript? pikaz JavaScript 20 07-10-10 12:55 AM


All times are GMT -5. The time now is 06:15 PM.
vBulletin® Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.