Novata

30/07/2004 - 22:28 por Fatima | Informe spam
me pueden ayudar soy nueva

estoy utlizando un Webform y necesito sacar la
informacion de una tabla a un label

me podrian indicar como tengo que hacer

Private Sub Form1_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load
' integrated security=SSPI;data
source=L3CEC04;inicial catalog=Northwind

Me.daCustomer.Fill(Me.dsCustomer1)
UpdateData()

End Sub

Public Sub UpdateData()
' binding ata una fuente a un objeto
'
With Me.dsCustomer1.Customers.Rows(Me.BindingContext
(Me.dsCustomer1, "Customers").Position)

Me.txtID.Text = .Item("CustomerID")
Me.txtcompany.Text = .Item("CompanyName")
Me.txtcompany.Text = .Item("Country")
End With
End Sub

en Visual basic .Net funciona pero utilizando una
webForm no existe el BindingContext

Me pueden ayudar con una programacion similar

Los agradesco mucho

Fatima
 

Leer las respuestas

#1 Franco Figún
31/07/2004 - 00:51 | Informe spam
Una posibilidad es hacerlo asi:

<%@ Page Language="VB" Debug="true" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<HTML>
<HEAD>
<TITLE>ASP.NET, SqlClient, VB.NET</TITLE>
</HEAD>
<BODY>
<%
Dim objconn As SqlConnection
Dim objcmd As SqlCommand
Dim objdr As SqlDataReader
Dim registros As Integer

objconn = New
SqlConnection("server=(local);uid=sa;pwd=password;database=northwind")
objconn.Open()

objcmd = New SqlCommand("Select * From customers", objconn)
objdr = objcmd.ExecuteReader()
%>
<%
registros = 1
Response.Write("<TABLE BORDER=1><TR><TD>Nro</TD><TD>cCustomerID</TD></TR>")

While objdr.Read
Response.Write("<TR><TD>" & registros & ".</TD><TD>" &
objdr.Item("CustomerID") & "</TD></TR>")
registros = registros + 1
End While

Response.Write("</TABLE>")
objdr.Close()
objconn.Close()
%>
</BODY>
</HTML>

FF
www.francofigun.com.ar
www.microsofties.com.ar
Yahoo MSN:

"Fatima" wrote in message
news:778001c47673$d3893e00$
me pueden ayudar soy nueva

estoy utlizando un Webform y necesito sacar la
informacion de una tabla a un label

me podrian indicar como tengo que hacer

Private Sub Form1_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load
' integrated security=SSPI;data
source=L3CEC04;inicial catalog=Northwind

Me.daCustomer.Fill(Me.dsCustomer1)
UpdateData()

End Sub

Public Sub UpdateData()
' binding ata una fuente a un objeto
'
With Me.dsCustomer1.Customers.Rows(Me.BindingContext
(Me.dsCustomer1, "Customers").Position)

Me.txtID.Text = .Item("CustomerID")
Me.txtcompany.Text = .Item("CompanyName")
Me.txtcompany.Text = .Item("Country")
End With
End Sub

en Visual basic .Net funciona pero utilizando una
webForm no existe el BindingContext

Me pueden ayudar con una programacion similar

Los agradesco mucho

Fatima

Preguntas similares