ASP访问SQL SERVER的更改 [英] ASP Access to SQL SERVER change
问题描述
我有一个在VBScript中完成的ASP页面
设置为读取Access数据库,我需要将其更改为阅读
a Sql 2005数据库。
用于打开Access数据库的代码:
设置adoConnection = server.CreateObject(" ADODB.Connection")
设置adoRecordset = server.CreateObject(" ADODB.Recordset")
adoConnection.Provider =" Microsoft.Jet.OLEDB.4.0"
Dim strLocation,iLength
strLocation = Request.ServerVariables(" PATH_TRANSLATED")
iLength = Len(strLocation)
iLength = iLength - 11
strLocation =左(strLocation,iLength)
strLocation = strLocation& " ../ Database.mdb"
adoConnection.Open(" Data Source = &&& strieocation)
adoRecordset.ActiveConnection = AdoConnection
在我的VB 6.0应用程序中,我使用以下命令打开SQL数据库
设置DataBaseTS_1 =新ADODB.Connection
DataBaseTS_1.ConnectionString =" ; Provider = MSDASQL.1;持久安全
Info = False; Extended
Properties = Description =大型泵数据源; DRIVER = SQL
服务器; SERVER = LPDATASYSTEM \ PL3LP; APP = Microsoft数据访问
组件; WSID = LPDATASYSTEM; DATABASE = LargePump; Tr usted_Connection = Yes; Initi
al Catalog = LargePump" ;
DataBaseTS_1.Open
如何获取VBScript打开SQL数据库?
谢谢,
Bob Hiller
为残疾人士有限责任公司提升
I have an ASP page that was done in VBScript
It is setup to read an Access database and I need to change it to read
a Sql 2005 Database.
The code that is used to open the Access Database:
Set adoConnection = server.CreateObject("ADODB.Connection")
Set adoRecordset = server.CreateObject("ADODB.Recordset")
adoConnection.Provider = "Microsoft.Jet.OLEDB.4.0"
Dim strLocation, iLength
strLocation = Request.ServerVariables("PATH_TRANSLATED")
iLength = Len(strLocation)
iLength = iLength - 11
strLocation = Left(strLocation, iLength)
strLocation = strLocation & "../Database.mdb"
adoConnection.Open ("Data Source=" & strLocation)
adoRecordset.ActiveConnection = AdoConnection
In my VB 6.0 app I use the following to open the SQL Database"
Set DataBaseTS_1 = New ADODB.Connection
DataBaseTS_1.ConnectionString ="Provider=MSDASQL.1;Persist Security
Info=False;Extended
Properties=Description=Large Pump Data Source;DRIVER=SQL
Server;SERVER=LPDATASYSTEM\PL3LP;APP=Microsoft Data Access
Components;WSID=LPDATASYSTEM;DATABASE=LargePump;Tr usted_Connection=Yes;Initi
al Catalog=LargePump"
DataBaseTS_1.Open
How can I get the VBScript to open the SQL Database?
Thanks,
Bob Hiller
Lifts for the Disabled LLC
推荐答案
Bob和Sharon Hiller写道:
Bob and Sharon Hiller wrote:
它设置为读取Access数据库,我需要更改它
以读取Sql 2005数据库。
< snip>如何让VBScript打开SQL数据库?
I have an ASP page that was done in VBScript
It is setup to read an Access database and I need to change it
to read a Sql 2005 Database. <snip> How can I get the VBScript to open the SQL Database?
http://www.aspfaq.com/show.asp?id=2126
-
Microsoft MVP - ASP / ASP .NET
请回复新闻组。我的From
标题中列出的电子邮件帐户是我的垃圾邮件陷阱,因此我不经常检查它。通过发布到新闻组,您将获得更快的回复。
http://www.aspfaq.com/show.asp?id=2126
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don''t check it very often. You will get a
quicker response by posting to the newsgroup.
这是我尝试过的:没有返回任何记录(此表有2094行,
28列)
设置adoConnection = server.CreateObject(" ADODB.Connection")
设置adoRecordset = server.CreateObject(" ADODB.Recordset")
adoConnection.ConnectionString =" Provider = MSDASQL.1;" _
& Persist Security Info = False; _
& 扩展属性=描述=大泵数据源; _
& DRIVER = SQL Server; SERVER = LPDATASYSTEM\PL3LP; _
& APP = Microsoft数据访问组件; _
& " WSID = LPDATASYSTEM; DATABASE = LargePump;" _
& " Trusted_Connection = Yes; Initial Catalog = LargePump"
adoConnection.Open
adoRecordset.ActiveConnection = adoConnection
Dim SqlSelect
SqlSelect =" select * from [LargePumpFloor_TS1] order by Row_num"
adoRecordset.CursorLocation = 3
adoRecordset.CursorType = 3
调用adoRecordset.Open(SQLSelect)
adoRecordset.PageSize = 12
adoRecordset.CacheSize = adoRecordset.PageSize
intPageCount = adoRecordset.PageCount
intRecordCount = adoRecordset.RecordCount
你看到了什么吗?我在Windows XP Pro上使用MS运行IIS
SQL Server 2005.我可以访问并查看任何MS Access数据库但没有SQL
数据库。
" Bob Barrows [MVP]" <再****** @ NOyahoo.SPAMcom>在消息中写道
新闻:我们************** @ TK2MSFTNGP09.phx.gbl ...
Here is what I have tried: No records are returned(This table has 2094 rows,
28 columns)
Set adoConnection = server.CreateObject("ADODB.Connection")
Set adoRecordset = server.CreateObject("ADODB.Recordset")
adoConnection.ConnectionString = "Provider=MSDASQL.1;" _
& "Persist Security Info=False;" _
& "Extended Properties=Description=Large Pump Data Source;" _
& "DRIVER=SQL Server;SERVER=LPDATASYSTEM\PL3LP;" _
& "APP=Microsoft Data Access Components;" _
& "WSID=LPDATASYSTEM;DATABASE=LargePump;" _
& "Trusted_Connection=Yes;Initial Catalog=LargePump"
adoConnection.Open
adoRecordset.ActiveConnection = adoConnection
Dim SqlSelect
SqlSelect = "select * from [LargePumpFloor_TS1] order by Row_num"
adoRecordset.CursorLocation = 3
adoRecordset.CursorType = 3
call adoRecordset.Open(SQLSelect)
adoRecordset.PageSize = 12
adoRecordset.CacheSize = adoRecordset.PageSize
intPageCount = adoRecordset.PageCount
intRecordCount = adoRecordset.RecordCount
Do you see anything ? I am running IIS on Windows XP Pro with MS
SQL Server 2005. I can access and see any MS Access Database but no SQL
databases.
"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:us**************@TK2MSFTNGP09.phx.gbl...
Bob和Sharon Hiller写道:
Bob and Sharon Hiller wrote:
我有一个在VBScript中完成的ASP页面
它设置为读取Access数据库,我需要将其更改为读取Sql 2005数据库。
I have an ASP page that was done in VBScript
It is setup to read an Access database and I need to change it
to read a Sql 2005 Database.
< snip>
<snip>
如何让VBScript打开SQL数据库?
How can I get the VBScript to open the SQL Database?
http://www.aspfaq.com/show.asp?id=2126
- <微软MVP - ASP / ASP.NET
请回复新闻组。我的From
标题中列出的电子邮件帐户是我的垃圾邮件陷阱,因此我不经常检查它。通过发布到新闻组,您将得到更快的回复。
http://www.aspfaq.com/show.asp?id=2126
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don''t check it very often. You will get a
quicker response by posting to the newsgroup.
Bob和Sharon Hiller写道:
Bob and Sharon Hiller wrote:
这是我试过的:没有记录返回(这个表有2094行,28列)
设置adoConnection = server.CreateObject(" ADODB.Connection")
设置adoRecordset = server.CreateObject(" ADODB.Recordset")
adoConnection.ConnectionString =" Provider = MSDASQL.1;" _
& Persist Security Info = False; _
& 扩展属性=描述=大泵数据源; _
& DRIVER = SQL Server; SERVER = LPDATASYSTEM\PL3LP; _
& APP = Microsoft数据访问组件; _
& " WSID = LPDATASYSTEM; DATABASE = LargePump;" _
& Trusted_Connection = Yes; Initial Catalog = LargePump
与你的问题无关,但你应该避免使用odbc。请参阅
中我的原始回复链接。
adoConnection.Open
adoRecordset.ActiveConnection = adoConnection
Dim SqlSelect
SqlSelect =" select * from [LargePumpFloor_TS1] order by Row_num"
adoRecordset.CursorLocation = 3
adoRecordset.CursorType = 3
call adoRecordset.Open(SQLSelect)
adoRecordset.PageSize = 12
adoRecordset.CacheSize = adoRecordset.PageSize
intPageCount = adoRecordset.PageCount
intRecordCount = adoRecordset.RecordCount
你看到了什么吗?我在Windows XP Pro上使用MS运行IIS SQL Server 2005.我可以访问并查看任何MS Access数据库但没有
SQL数据库。
Here is what I have tried: No records are returned(This table has
2094 rows, 28 columns)
Set adoConnection = server.CreateObject("ADODB.Connection")
Set adoRecordset = server.CreateObject("ADODB.Recordset")
adoConnection.ConnectionString = "Provider=MSDASQL.1;" _
& "Persist Security Info=False;" _
& "Extended Properties=Description=Large Pump Data Source;" _
& "DRIVER=SQL Server;SERVER=LPDATASYSTEM\PL3LP;" _
& "APP=Microsoft Data Access Components;" _
& "WSID=LPDATASYSTEM;DATABASE=LargePump;" _
& "Trusted_Connection=Yes;Initial Catalog=LargePump"
Nothing to do with your problem, but you should avoid odbc. See the link in
my original reply.
adoConnection.Open
adoRecordset.ActiveConnection = adoConnection
Dim SqlSelect
SqlSelect = "select * from [LargePumpFloor_TS1] order by Row_num"
adoRecordset.CursorLocation = 3
adoRecordset.CursorType = 3
call adoRecordset.Open(SQLSelect)
adoRecordset.PageSize = 12
adoRecordset.CacheSize = adoRecordset.PageSize
intPageCount = adoRecordset.PageCount
intRecordCount = adoRecordset.RecordCount
Do you see anything ? I am running IIS on Windows XP Pro with MS
SQL Server 2005. I can access and see any MS Access Database but no
SQL databases.
我看到了没有尝试检查记录集的EOF属性。你是如何确定没有返回任何记录的?b
$ b -
Microsoft MVP - ASP / ASP.NET
请回复新闻组。我的From
标题中列出的电子邮件帐户是我的垃圾邮件陷阱,因此我不经常检查它。通过发布到新闻组,您将获得更快的回复。
I see no attempt to check the recordset''s EOF property. How are you
determining that no records were returned?
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don''t check it very often. You will get a
quicker response by posting to the newsgroup.
这篇关于ASP访问SQL SERVER的更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!