Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

codigo para conexion a base de datos, Essays (high school) of French

codigo c# para conexión a base de datos

Typology: Essays (high school)

2023/2024

Uploaded on 09/06/2024

ingrid-biviana-vega-perez-1
ingrid-biviana-vega-perez-1 🇺🇸

1 document

Partial preview of the text

Download codigo para conexion a base de datos and more Essays (high school) French in PDF only on Docsity! Visual Basic Imports System.Data Imports System.Data.SqlClient Dim sCnn As String sCnn = "data source = ServidorSQL; initial catalog = BaseDatos; user id = Usuario; password = Contraseña" Dim sSel As String = "SELECT * FROM NombreTabla" Dim da As SqlDataAdapter Dim dt As New DataTable Try da = New SqlDataAdapter(sSel, sCnn) da.Fill(dt) Me.GridView1.DataSource = dt Me.GridView1.DataBind() LabelInfo.Text = String.Format("Total datos en la tabla: {0}", dt.Rows.Count) Catch ex As Exception LabelInfo.Text = "Error: " & ex.Message End Try C# using System.Data.SqlClient; string sCnn; sCnn = "data source = ServidorSQL; initial catalog = BaseDatos; user id = Usuario; password = Contraseña"; string sSel = "SELECT * FROM NombreTabla"; SqlDataAdapter da; DataTable dt = new DataTable(); try { da = new SqlDataAdapter(sSel, sCnn); da.Fill(dt); this.GridView1.DataSource = dt; this.GridView1.DataBind(); LabelInfo.Text = String.Format("Total datos en la tabla: {0}", dt.Rows.Count); } catch(Exception ex) { LabelInfo.Text = "Error: " + ex.Message; }