Join 136,459 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,806 people online right now. Registration is fast and FREE... Join Now!
I'm trying to connect to a SQL 2005 database with a asp.net web page I created. I tried every thing that I could think of. I dis enable all the default settings on the database. Here is the code that is in the Web Config file which is suppose to connect my web page to the database:
I'm trying to connect to a SQL 2005 database with a asp.net web page I created. I tried every thing that I could think of. I dis enable all the default settings on the database. Here is the code that is in the Web Config file which is suppose to connect my web page to the database:
Hiiiiiii Try this code for connecting simple login page to the database using sessions This code is only for Simple login page............. I hope this may be helps u to understand a few
CODE
using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Data.SqlClient;
public partial class _Default : System.Web.UI.Page {
static SqlConnection con = new SqlConnection(@"Data Source=divya;Initial Catalog=divproject;Integrated Security=True");
try { SqlDataAdapter da = new SqlDataAdapter("select * from login where userid like '" + TextBox1.Text + "' and password like '" + TextBox2.Text + "' ", con); DataSet ds = new DataSet(); da.Fill(ds, "login"); if (ds.Tables["login"].Rows[0][0] != null) { Session.Add("id", TextBox1.Text);