如何在.net2005下连接INSQL数据库
(1)已启动INSQL数据库(2)已启动SQLserver(3)使用了DBUtility.dll
在web.config中增加如下设置,即 链接到Runtime库即可
<connectionStrings>
<add name="connectiontoSQL" connectionString="server=localhost; database=Runtime;uid=sa;pwd=sa " /> </connectionStrings>
在代码中,如下编写
string str = "SELECT TagName, Value FROM INSQL.Runtime.dbo.Live WHERE TagName = 'SysTimeSec'";
SqlDataReader dr = FD.DBUtility.SqlHelper.ExecuteReader(connectionString, CommandType.Text, str, null);
GridView1.DataSource = dr;
GridView1.DataBind();