12/10/08 20:16
buzzicotta
salve a tutti..sto provando a popolare una drop down list da database..
sapete dirmi l'errore? grazie mille
sapete dirmi l'errore? grazie mille
Protected Sub cat_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Dim con As New System.Data.OleDb.OleDbConnection("Provider=SQLOLEDB;Data Source=GOMMOSA\SQLEXPRESS;Initial Catalog=MIO_SITO;User ID=sa;Password=saweb") con.Open() Dim com As New System.Data.OleDb.OleDbCommand() com.Connection = con com.CommandText = "select DENOMINAZIONE from CATEGORIE" Dim da As New System.Data.OleDb.OleDbDataAdapter() da.SelectCommand = com Dim ds As New DataSet1() da.Fill(ds, "CATEGORIE") Me.cat.DataSource = ds.Tables("CATEGORIE") Me.cat.DataValueField = "DENOMINAZIONE" con.Close() End Sub Protected Sub cat2_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Dim con2 As New System.Data.OleDb.OleDbConnection("Provider=SQLOLEDB;Data Source=GOMMOSA\SQLEXPRESS;Initial Catalog=MIO_SITO;User ID=sa;Password=saweb") con2.Open() Dim com2 As New System.Data.OleDb.OleDbCommand() com2.Connection = con2 com2.CommandText = "select DENOMINAZIONE from CATEGORIE" Dim da2 As New System.Data.OleDb.OleDbDataAdapter() da2.SelectCommand = com2 Dim dr1 As System.Data.OleDb.OleDbDataReader dr1 = com2.ExecuteReader() cat2.DataSource = dr1 cat2.DataBind() dr1.Close() con2.Close() 'cat2.Items.Insert(0, "<---select--->") End Sub
aaa