01.
idx = document.getElementById(
"odbclist"
).selectedIndex
02.
03.
strDriver =
"{"
& document.getElementById(
"odbclist"
).options(idx).text &
"}"
04.
strServer = document.getElementById(
"p03"
).value
05.
strUser = document.getElementById(
"p01"
).value
06.
strPass = document.getElementById(
"p02"
).value
07.
strTable = document.getElementById(
"p04"
).value
08.
strDb = document.getElementById(
"db_name"
).value
09.
strFile = document.getElementById(
"db_file"
).value
10.
11.
ConnectionString = _
12.
"Provider=MSDASQL"
& _
13.
";Driver="
& strDriver
14.
15.
if strFile <>
""
then
16.
ConnectionString = ConnectionString &
";Dbq="
& strFile
17.
end if
18.
if strServer <>
""
then
19.
ConnectionString = ConnectionString &
";Server="
& strServer
20.
end if
21.
if strDb <>
""
then
22.
ConnectionString = ConnectionString &
";Database="
& strDb
23.
end if
24.
if strUser <>
""
then
25.
ConnectionString = ConnectionString &
";UID="
& strUser
26.
end if
27.
if strPass <>
""
then
28.
ConnectionString = ConnectionString &
";PWD="
& strPass
29.
end if
30.
31.
ConnectionString = ConnectionString &
";"
32.
33.
if document.getElementById(
"connectopt"
).value <>
""
then
34.
ConnectionString = _
35.
ConnectionString & document.getElementById(
"connectopt"
).value &
";"
36.
end if