TADOConnection控件如何在原程序中使用?
在原程序中
TADOConnection *con1 = new TADOConnection(this);//这一句不出错。
String s1,pwd;
s1 = "Provider=SQLOLEDB.1;Persist Security Info=False; ";
s1+= "User ID=sa;pwd= ";
s1+= pwd;
s1+= ";Initial Catalog=master;Data Source=. " ;
con1-> ConnectionString = s1;//这一句为何出错
con1-> LoginPrompt = false;
con1-> Connected=true ;
[解决办法]
~!~原来可没这么说啊!
Console wizard 下
TADOConnection *con1 = new TADOConnection(this);//这一句不出错????????
this是什么意思??
[解决办法]
CoInitialize(NULL);
TADOConnection *con1 = new TADOConnection(NULL);//这一句不出错。
printf( "HelloWorld ");
String s1,pwd;
s1 = "Provider=SQLOLEDB.1;Persist Security Info=False; ";
s1+= "User ID=sa;pwd= ";
s1+= pwd;
s1+= ";Initial Catalog=master;Data Source=. " ;
con1-> ConnectionString = s1;//这一句为何出错
con1-> LoginPrompt = false;
con1-> Connected=true ;
delete con1;
CoUninitialize();