!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> <table> <tr> <td> <asp:Label ID="Label1" runat="server" Text=""></asp:Label></td> <td> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> </td> </tr> </table> </div> </form> </body> </html>
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using System.Data.SqlClient; public partial class Default4 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { SqlConnection con = new SqlConnection (@"Data Source=DESKTOP-UT3J1JD\SQL14ONUR; Initial Catalog=onurgridview; Integrated Security=True;MultipleActiveResultSets=True; Connection Timeout=900"); String str = "select * from country"; SqlCommand cmd = new SqlCommand(str, con); con.Open(); SqlDataReader dr = cmd.ExecuteReader(); if (dr.Read()) { TextBox1.Text = dr["countryid"].ToString(); Label1.Text = dr["photo"].ToString(); } con.Close(); } }
label
textbox
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)