PDA

View Full Version : سوال: دسترسی به پایگاه داده با ASP



morteza271
پنج شنبه 21 مرداد 1389, 22:13 عصر
سلام دوستان...
من با استفاده از ASP میخوام به Sql متصل بشم و اطلاعات رو از جدولم بخونم و در یک Gridview در سایت نشون بدم ولی خطا میده،کسی میدونه اشکالش چیه؟
اینم کد:

SqlConnection sqlcon = new SqlConnection(@"data source=.\\sqlexpress;attachdbfilename=|datadirecto ry|\\db_test1.mdf;
integrated security=true");
SqlDataAdapter sqlda = new SqlDataAdapter("select * from users", sqlcon);
DataSet sqlds = new DataSet();
sqlda.Fill(sqlds);
GridView1.DataSource = sqlds;
GridView1.DataBind();

توی این خط خطا میگیره :
sqlda.Fill(sqlds);
اینم خطاش :
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: Instance failure.