提示Keyword not supported: 'datasource'.
我写了下面的代码,可是提示我不支持 'datasource',应该怎么解决?string strConn = ConfigurationManager.ConnectionStrings["NorthwindconnectionString"].ConnectionString;
SqlConnection conn = new SqlConnection(strConn);
string strSQL = "proc_GetCommendIndex";
SqlCommand comm = new SqlCommand(strSQL, conn);
comm.CommandType = CommandType.StoredProcedure;
SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand = comm;
conn.Open();
DataSet ds = new DataSet();
da.Fill(ds, "table");
Datalist2.DataSource = ds;
Datalist2.DataBind();
conn.Close();
--------------------编程问答-------------------- 不知道是什么东西Datalist2 --------------------编程问答-------------------- 提示在SqlConnection conn = new SqlConnection(strConn);这一行出错 --------------------编程问答--------------------
你在web.config中的数据库连接字符串写的不对,datasource应该是database --------------------编程问答-------------------- <add name="NorthwindConnectionString" connectionString="datasource=.;Initial Catalog=rcw;User ID=sa;Password=123$123 " providerName="System.Data.SqlClient"/>
我的web.config这样写的,可是报错说不支持 'datasource'
datasource应该是database也不对 --------------------编程问答-------------------- <add name="NorthwindConnectionString" connectionString="data source=.;Initial Catalog=rcw;User ID=sa;Password=123$123 " providerName="System.Data.SqlClient"/>
--------------------编程问答-------------------- connectionString="server=.;database=databasename;uid=useraccount;pwd=password" --------------------编程问答--------------------
connectionString="server=.;Initial Catalog=rcw;User ID=sa;Password=123$123 "
或
connectionString="Data Source=.;Initial Catalog=rcw;User ID=sa;Password=123$123 "
中间有空格 --------------------编程问答-------------------- 字符串 Data Source
补充:.NET技术 , ASP.NET