张硕御月
发表于 2011-10-31 14:59:01
87,Q:Asp 中无 DSN 法连接 SQL Server 数据库的方法及其注意问题
A:无 DSN 法连接 SQL Server 数据库的方法示例如下:
'Less-DSN 法连接 SQLServer 服务器
set conn=server.createObject("adodb.connection")
conn.Open "driver={SQL Server};server=mysqlserver; database=jspcs; uid=sa;
pwd=sql"
其中服务器名为 mysqlserver(ip=192.168.0.1),数据库为 jspcs,用户名为 sa,口令为 sql。由于使用了 TCP/IP
协议,所以 server=mysqlserver 语句段还可以写成指向安装 SQL Server 的机器的 IP 地址,即
server=192.168.0.1,注意该 IP 地址必须是网卡的默认(基本) IP 地址。同时,如果在 Client 端设置 SQL Server
ODBC,也可以把服务器名输成 SQL Server 的 IP 地址。
张硕御月
发表于 2011-10-31 14:59:12
88,Q:Delphi 中判断系统是否已经安装了声卡
A:要判断系统是否安装了声卡,调用 Winmm.dll 中的 waveOutGetNumDevs 和 midiOutGetNumDevs
函数就可以了。这两个函数在 Var 部分的说明如下:
function waveOutGetNumDevs: longint; stdcall; external 'winmm.dll' name
'waveOutGetNumDevs';
function midiOutGetNumDevs: longint; stdcall; external 'winmm.dll' name
'midiOutGetNumDevs';
//判断声卡是否存在
Function IsSoundcardInstalled : Boolean;
Var
WaveOutPutDeviceCount : Integer;
MidiOutPutDeviceCount : Integer;
Begin
Result := False;
WaveOutPutDeviceCount := waveOutGetNumDevs;
MidiOutPutDeviceCount := midiOutGetNumDevs;
if (WaveOutPutDeviceCount>0) and (MidiOutPutDeviceCount>0) Then
Result := True
Else
Result := False;
End;
procedure TForm1.Button1Click(Sender: TObject);
Begin
if IsSoundcardInstalled Then
ShowMessage('系统已经安装了声卡.')
Else
ShowMessage('系统没有安装声卡.');
end;
张硕御月
发表于 2011-10-31 14:59:21
89,Q:用 ASP 打开 Web 服务器上的应用程序
A:
<%
dim wsh
set wsh = createobject("WScript.Shell")
response.write wsh.run("command.com")
set wsh = nothing
%>