datos enlazados a una tabla no se muestran

26/01/2004 - 20:56 por La Rocca Network S.A. / Nelson | Informe spam
Hi !

I've just created a simple form using visutal studio (vb.net), created
webform1 having an oledataconn, oledataadapter, and a dataset, a listbox
bounded to the dataset ... but when showing the page in the explorer, no
data appears

any help ?

I'm sure I'm missing something.
thanks a lot in advance for your help

regards,
nelson


code for the aspx and vb files follows

****************************************************************************
*****************

<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb"
Inherits="lp.WebForm1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>WebForm1</title>
<meta name="GENERATOR" content="Microsoft Visual Studio.NET 7.0">
<meta name="CODE_LANGUAGE" content="Visual Basic 7.0">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intell...">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<asp:ListBox id=ListBox1 style="Z-INDEX: 101; LEFT: 368px; POSITION:
absolute; TOP: 208px" runat="server" DataSource="<%# DataSet11 %>"
DataTextField="descriptionES" DataValueField="id" DataMember="countries">
</asp:ListBox>
</form>
</body>
</HTML>

****************************************************************************
*****************

Public Class WebForm1
Inherits System.Web.UI.Page
Protected WithEvents ListBox1 As System.Web.UI.WebControls.ListBox
Protected WithEvents OleDbDataAdapter1 As
System.Data.OleDb.OleDbDataAdapter
Protected WithEvents OleDbSelectCommand1 As
System.Data.OleDb.OleDbCommand
Protected WithEvents OleDbConnection1 As
System.Data.OleDb.OleDbConnection
Protected WithEvents DataSet11 As lp.DataSet1

#Region " Código generado por el Diseñador de Web Forms "

'El Diseñador de Web Forms requiere esta llamada.
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
Me.OleDbDataAdapter1 = New System.Data.OleDb.OleDbDataAdapter()
Me.OleDbSelectCommand1 = New System.Data.OleDb.OleDbCommand()
Me.OleDbConnection1 = New System.Data.OleDb.OleDbConnection()
Me.DataSet11 = New lp.DataSet1()
CType(Me.DataSet11,
System.ComponentModel.ISupportInitialize).BeginInit()
'
'OleDbDataAdapter1
'
Me.OleDbDataAdapter1.SelectCommand = Me.OleDbSelectCommand1
Me.OleDbDataAdapter1.TableMappings.AddRange(New
System.Data.Common.DataTableMapping() {New
System.Data.Common.DataTableMapping("Table", "countries", New
System.Data.Common.DataColumnMapping() {New
System.Data.Common.DataColumnMapping("id", "id"), New
System.Data.Common.DataColumnMapping("descriptionES", "descriptionES")})})
'
'OleDbSelectCommand1
'
Me.OleDbSelectCommand1.CommandText = "SELECT id, descriptionES FROM
countries ORDER BY descriptionES"
Me.OleDbSelectCommand1.Connection = Me.OleDbConnection1
'
'OleDbConnection1
'
Me.OleDbConnection1.ConnectionString "Provider=SQLOLEDB.1;Password=mypass;Persist Security Info=True;User
ID=sa;Initi" & _
"al Catalog=ecommerce;Data Source2.168.100.180;Use Procedure for
Prepare=1;Aut" & _
"o Translate=True;Packet Size@96;Workstation ID=AGUILA;Use
Encryption for Data=" & _
"False;Tag with column collation when possible=False"
'
'DataSet11
'
Me.DataSet11.DataSetName = "DataSet1"
Me.DataSet11.Locale = New System.Globalization.CultureInfo("en-US")
Me.DataSet11.Namespace = "http://www.tempuri.org/DataSet1.xsd"
CType(Me.DataSet11,
System.ComponentModel.ISupportInitialize).EndInit()

End Sub

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
'CODEGEN: el Diseñador de Web Forms requiere esta llamada de método
'No lo modifique con el editor de código.
InitializeComponent()
End Sub

#End Region

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Introducir aquí el código de usuario para inicializar la página
End Sub

End Class

****************************************************************************
*****************
 

Leer las respuestas

#1 Anonimo
27/01/2004 - 19:12 | Informe spam
Nelson:

Try to put the following code in Sub _Load of your .aspx:

if Not IsPostBack then
ListBox1.Databind
End if

I hope it helps you.

-Julio Moncisbays


Hi !

I've just created a simple form using visutal studio


(vb.net), created
webform1 having an oledataconn, oledataadapter, and a


dataset, a listbox
bounded to the dataset ... but when showing the page in


the explorer, no
data appears

any help ?

I'm sure I'm missing something.
thanks a lot in advance for your help

regards,
nelson


code for the aspx and vb files follows

*********************************************************


*******************
*****************

<%@ Page Language="vb" AutoEventWireup="false"


Codebehind="WebForm1.aspx.vb"
Inherits="lp.WebForm1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0


Transitional//EN">
<HTML>
<HEAD>
<title>WebForm1</title>
<meta name="GENERATOR" content="Microsoft Visual


Studio.NET 7.0">
<meta name="CODE_LANGUAGE" content="Visual Basic 7.0">
<meta name="vs_defaultClientScript"


content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intell...">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<asp:ListBox id=ListBox1 style="Z-INDEX: 101; LEFT:


368px; POSITION:
absolute; TOP: 208px" runat="server" DataSource="<%#


DataSet11 %>"
DataTextField="descriptionES" DataValueField="id"


DataMember="countries">
</asp:ListBox>
</form>
</body>
</HTML>

*********************************************************


*******************
*****************

Public Class WebForm1
Inherits System.Web.UI.Page
Protected WithEvents ListBox1 As


System.Web.UI.WebControls.ListBox
Protected WithEvents OleDbDataAdapter1 As
System.Data.OleDb.OleDbDataAdapter
Protected WithEvents OleDbSelectCommand1 As
System.Data.OleDb.OleDbCommand
Protected WithEvents OleDbConnection1 As
System.Data.OleDb.OleDbConnection
Protected WithEvents DataSet11 As lp.DataSet1

#Region " Código generado por el Diseñador de Web Forms "

'El Diseñador de Web Forms requiere esta llamada.
<System.Diagnostics.DebuggerStepThrough()> Private


Sub
InitializeComponent()
Me.OleDbDataAdapter1 = New


System.Data.OleDb.OleDbDataAdapter()
Me.OleDbSelectCommand1 = New


System.Data.OleDb.OleDbCommand()
Me.OleDbConnection1 = New


System.Data.OleDb.OleDbConnection()
Me.DataSet11 = New lp.DataSet1()
CType(Me.DataSet11,
System.ComponentModel.ISupportInitialize).BeginInit()
'
'OleDbDataAdapter1
'
Me.OleDbDataAdapter1.SelectCommand =


Me.OleDbSelectCommand1
Me.OleDbDataAdapter1.TableMappings.AddRange(New
System.Data.Common.DataTableMapping() {New
System.Data.Common.DataTableMapping


("Table", "countries", New
System.Data.Common.DataColumnMapping() {New
System.Data.Common.DataColumnMapping("id", "id"), New
System.Data.Common.DataColumnMapping


("descriptionES", "descriptionES")})})
'
'OleDbSelectCommand1
'
Me.OleDbSelectCommand1.CommandText = "SELECT id,


descriptionES FROM
countries ORDER BY descriptionES"
Me.OleDbSelectCommand1.Connection =


Me.OleDbConnection1
'
'OleDbConnection1
'
Me.OleDbConnection1.ConnectionString >"Provider=SQLOLEDB.1;Password=mypass;Persist Security


Info=True;User
ID=sa;Initi" & _
"al Catalog=ecommerce;Data


Source2.168.100.180;Use Procedure for
Prepare=1;Aut" & _
"o Translate=True;Packet ;Workstation


ID=AGUILA;Use
Encryption for Data=" & _
"False;Tag with column collation when


possible=False"
'
'DataSet11
'
Me.DataSet11.DataSetName = "DataSet1"
Me.DataSet11.Locale = New


System.Globalization.CultureInfo("en-US")
Me.DataSet11.Namespace


= "http://www.tempuri.org/DataSet1.xsd"
CType(Me.DataSet11,
System.ComponentModel.ISupportInitialize).EndInit()

End Sub

Private Sub Page_Init(ByVal sender As System.Object,


ByVal e As
System.EventArgs) Handles MyBase.Init
'CODEGEN: el Diseñador de Web Forms requiere


esta llamada de método
'No lo modifique con el editor de código.
InitializeComponent()
End Sub

#End Region

Private Sub Page_Load(ByVal sender As System.Object,


ByVal e As
System.EventArgs) Handles MyBase.Load
'Introducir aquí el código de usuario para


inicializar la página
End Sub

End Class

*********************************************************


*******************
*****************




.

Preguntas similares