ASP.NET database connection question?

Mit Chauhan

New member
JAI MATADI all . .

m trying to make database connections through my ASP.NET with MSSQL ..

so far it was going very well ..

but suddenly i dont know but when m making even the simple connection m getting the same output in my gridview as a TAble like this ..

-------------------------------------------
(This is my Gridview)

Item
t
a
b
l
e
-------------------------------------------

i have made new web applications and new tables to confirm it out .. but m getting the same output everywhere suddenly ..

i dont know whats going on ..

here is my code for more info ..

-----------------------------------------------------
using System.Data.SqlClient;
using System.Data;
using System.IO;


public partial class _Default : System.Web.UI.Page
{
public string connstr = @"Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Documents and Settings\Chandrik Tools\My Documents\Visual Studio 2010\WebSites\Age Finding users from database\App_Data\Database.mdf;Integrated Security=True;User Instance=True";
protected void Page_Load(object sender, EventArgs e)
{
SqlConnection conn = new SqlConnection(connstr);
conn.Open();
string qry;
qry = "select * from table33";
SqlCommand cmd = new SqlCommand(qry, conn);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds, "table");
conn.Close();
GridView1.DataSource = ds.Tables["table"].ToString();
GridView1.DataBind();

}
}
-----------------------------------------------------------------------
 
Back
Top