SqlConnection conn=new SqlConnection("Server=myserver;Database=mydb;Uid=sa;pwd=");
conn.Open();这样写报错吗?
conn.Open();这样写报错吗?
解决方案 »
- 自动post的问题
- 倒计时label控件
- Gridview中添加Checkbox后,无法判断CheckBox的被选中状态?
- 求一套完整的生成静态的asp.net网站(带源码),我感激不尽!
- 有VS2003在安装了VS2005后提示 提示“用户不在Dubegger Users请与管理员联系”
- 如何控制访问安全
- 如果在设计视图看不见DataList控件, 怎么为它的非默认事件创建事件处理程序?
- ———— 刚学ASP.net菜鸟求助,求求你们 救救我——
- 纳闷,为什么web.config改为gb2312,整个项目的汉字都横排?
- 关于windows server 2003
- 如何写类似留言本的显示回复的程式
- 安装.net环境后出现sql server驱动程序丢失???急!!!!!!!!!!!!!
都试过了,还报同样的错!
连接字符串从csdn中拷的,还报错!是否是系统有问题,还是visual studio.net未装好
非常着急,请高手援手!!
string connstr="server=local);database=yourDB;Trusted_Connection=yes";
string connstr="server=local);database=yourDB;Trusted_Connection=yes";
using System;
using System.Data;
using System.Data.SqlClient;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace test
{
/// <summary>
/// b 的摘要说明。
/// </summary>
public class b : System.Web.UI.Page
{
public TextBox TextBox1;
public Button Button1;
public SqlConnection conn;
public SqlDataAdapter cmd;
public DataSet ds;
public System.Web.UI.WebControls.DataGrid DataGrid1;
public b()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
public void Button1_Click(object sender, System.EventArgs e)
{
string connstr="server=(local);database=db;Trusted_Connection=yes;Uid=sa;pwd=";
conn=new SqlConnection(connstr);
conn.Open();
TextBox1.Text="ook!";
}
}
}
}
Server Error in '/test' Application.
--------------------------------------------------------------------------------Method not found: Void System.Threading.WaitCallback..ctor(System.Object, IntPtr).
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.MissingMethodException: Method not found: Void System.Threading.WaitCallback..ctor(System.Object, IntPtr).Source Error:
Line 33: string connstr="server=(local);database=sx_customs;Trusted_Connection=yes;Uid=sa;pwd=";
Line 34: conn=new SqlConnection(connstr);
Line 35: conn.Open();
Line 36: //SqlCommand cd =new SqlCommand("select * from id",conn);
Line 37: //cd.Connection=this.conn;
Source File: e:\web\weba\test\b.cs Line: 35 Stack Trace:
[MissingMethodException: Method not found: Void System.Threading.WaitCallback..ctor(System.Object, IntPtr).]
System.Data.SqlClient.SqlConnection.Open() +761
test.b.Button1_Click(Object sender, EventArgs e) in e:\web\weba\test\b.cs:35
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +660
--------------------------------------------------------------------------------
Version Information: Runtime Build:1.0.2914.16; ASP.NET Build:1.4000.2914.16
====这样连接的话,是不需要指定uid和pwd的啊,加上了反而有问题