我的连接字串是这样的
constr.Format("Provider=sqloledb;Persist Security Info=false;User ID=%s;Initial Catlog=%s;Data Source=%s;Password=%s",UserName,DbName,ServerName,UserPwd);
其中有dbname制定使用的数据库名成
打开数据库是成功的
但是当执行到
"insert into USERLOGIN (USERNAME,USERPWD,POPEDOM) VALUES('%s','%s',%d)",UserName,UserPwd,Popedom
这个以后就出现
invalid object name USERLOGIN
但是USERLOGIN这个表确实存在呀!
不知道这个是什么原因!
constr.Format("Provider=sqloledb;Persist Security Info=false;User ID=%s;Initial Catlog=%s;Data Source=%s;Password=%s",UserName,DbName,ServerName,UserPwd);
其中有dbname制定使用的数据库名成
打开数据库是成功的
但是当执行到
"insert into USERLOGIN (USERNAME,USERPWD,POPEDOM) VALUES('%s','%s',%d)",UserName,UserPwd,Popedom
这个以后就出现
invalid object name USERLOGIN
但是USERLOGIN这个表确实存在呀!
不知道这个是什么原因!
再把你的%s都加上单引号试试
用QueryAnalyzer是可以查询的
我是用
insert into [USERLOGIN] ([USERNAME],[USERPWD],[POPEDOM]) VALUES('11','11',1)
结果正常
但是在我得程序中还是不行!查询语句也是用[]包含起来了的!真是奇怪了!
我是用的sqlserver2000 version 8.00.194
我的数据库连接是成功的呀!
而且在query analyzer里面有没有空格也没有影响的说!
用sa试试
我怀疑是我得程序登陆的数据库并不是我想要的数据库
我的数据库连接字段是这样的
constr.Format("Provider=sqloledb;Persist Security Info=false;User ID='%s';Initial Catlog='%s';Data Source='%s';Password='%s'",UserName,DbName,ServerName,UserPwd);
不知道是不是有问题!连接是成功的。
例如我得数据库名成叫做NadirSys单步执行发现Initial Catlog='NadirSys'.
难道是这里出现问题了!?