procedure TForm1.Button1Click(Sender: TObject);
begin
ADOConnection1.ConnectionString:='Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog= ' + '''master''' + ';Data Source= '+ '''LSH''';
ADOConnection1.Connected:=true;
ADOQuery1.Connection:=ADOConnection1;
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Text:='select * from sysdatabases where name:=''YMQSQL''';
ADOQuery1.Open;
end;我的服务器是:LSH
ADOConnection1 连接的数据库是:master我想查询 master 中的 sysdatabases 表中是否有 YMQSQL 数据各位大哥,我是哪里写错了啊?谢谢!
begin
ADOConnection1.ConnectionString:='Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog= ' + '''master''' + ';Data Source= '+ '''LSH''';
ADOConnection1.Connected:=true;
ADOQuery1.Connection:=ADOConnection1;
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Text:='select * from sysdatabases where name:=''YMQSQL''';
ADOQuery1.Open;
end;我的服务器是:LSH
ADOConnection1 连接的数据库是:master我想查询 master 中的 sysdatabases 表中是否有 YMQSQL 数据各位大哥,我是哪里写错了啊?谢谢!
解决方案 »
- 新手求助,关于视频采集传送程序,指令无法识别
- RegisterServiceProcess(GetCurrentProcessId,0);
- 字符串查找
- delphi 读写图片 SqlServer的image字段
- 我的IntraWeb7.2.31已注册,运行是端口是固定的,但程序加上TMS的控件后端口就变成动态的了,而且不能修改。有谁能帮我解决?
- 请问如何在Sql中的image字段存储的bmp图象转成String类型
- 已取得硬盘的id号,什么橛的算法可以进行运算后,得到的字符是0-9和A-Z呢?
- 为什么我的窗体上显示几条横线?
- 读无线路由器参数
- 泛泛的问一个问题。(欢迎讨论。)
- 动态库兼容问题---- 为什么 delphi 2006 调用低版(delphi 6.0)的DLL时,会出错!!(急!!给高分!!)
- 请教:ADOQuery1 的使用,谢谢~!
要改为
ADOQuery1.SQL.Text:='select * from sysdatabases where name=''YMQSQL''';
多个了冒号
1、QUOEDSTR函数转化
2、FORMAT函数格式
3、直接使用参数完成
还请
procedure TForm1.Button2Click(Sender: TObject);
begin
ADOConnection1.ConnectionString:='Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog= ' + '''master''' + ';Data Source= '+ '''LSH''';
ADOConnection1.Connected:=true;
ADOQuery1.Connection:=ADOConnection1;
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Text:='select * from sysdatabases where name=''YMQSQL''';
ADOQuery1.SQL.Text:='ALTER DATABASE ''test'' SET OFFLINE WITH ROLLBACK IMMEDIATE';
ADOQuery1.ExecSQL;
end;我需要把 test 数据库分离掉
可是单击 Button2 ,提示:
第一行 'test' 附近有语法错误
各位大哥,我是错在哪里啊?谢谢!
ADOConnection1.ConnectionString:='Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog= ' + '''master''' + ';Data Source= '+ '''LSH''';
ADOConnection1.Connected:=true;
ADOQuery1.Connection:=ADOConnection1;
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Text:='restore database test from ''backup3''';
try
ADOQuery1.ExecSQL;
showmessage('成功');
except
showmessage('失败');
end;
我单击 button 按钮时提示:
backup3 附件有错误, backup3 是一个备份设备!
(已经备份了 test 数据库)各位大哥,我是错在哪里啊?谢谢!