cbc+ADO+SQL SERVER 连接问题
各位大侠:
小弟我刚刚接触CBC,有谁有简单点的cbc+ADO+SQL SERVER源码,100分相送
不甚感激!
seven_gl@163.com
[解决办法]
strCon = "Provider=SQLOLEDB.1;Persist Security Info=True;User ID= " +
m_strUser + ";Password= " +
m_strPassword + ";Data Source= " +
m_strServer + ";Initial Catalog= " +
m_strDBName + ";PLSQLRSet=1 ";
con-> LoginPrompt = false;
///再次连接时要先关闭
con-> Close();
con-> ConnectionString = strCon;
con-> Open();
[解决办法]
用DBGrid显示就可以了,什么都不要写,只要连接下就可以了,
在你的页面上加一个DataSource1和,DBGrid1,
然后设置下DataSource1的属性DataSet为ADOQuery1,DBGrid1的DataSource属性为DataSource1就可以了,然后
String m_strUser = "sa ",
m_strPassword = " ",
m_strDBName = "hotellink ",
biaoming = "入住单 ",
m_strServer = "DINGYF ";
String con = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID= " +
m_strUser + ";Password= " +
m_strPassword + ";Initial Catalog= " +
m_strDBName + ";Data Source= " +
m_strServer;
ADOConnection1-> Close();
ADOConnection1-> LoginPrompt = false;
ADOConnection1-> ConnectionString = con;
ADOConnection1-> Open();
ADOQuery1-> Connection = ADOConnection1;
ADOQuery1-> Close();
ADOQuery1-> SQL-> Text = "select * from " + biaoming;
ADOQuery1-> Open();