Guest fsoudbakhsh Report post Posted 09/24/2006 07:41 AM Hello, would you please modify example below in your help page so that it retrieves data from the web database (Access database uploaded to host)? Your help will benefit a lot of people who have problem retrieving data with VoiceGuide from a web database. Thanks Example 13: Retrieving data from an MS SQL Server Database: set vg = CreateObject("VoiceGuide.CommandLink") set cn = CreateObject("ADODB.Connection") set rs = CreateObject("ADODB.Recordset") cn.Open "Provider=SQLOLEDB;Server=DBSERVER1;UID=user;PWD=user;Database=Ads" 'MSSQL authentication if cn.State <> 1 then vg.Admin_TraceLogAdd iLineId, 5, "login LeadingAd connection to database could not be made" vg.Run_ResultReturn iLineId, "fail" WScript.Quit end if set rs.ActiveConnection = cn sSQL = "SELECT TOP 1 AdID, Filename, PlayCount, LastPlayTime FROM AdList WHERE PlayCount < PlayCountMax AND Active <> 0 ORDER BY LastPlayTime" rs.Open sSQL, cn, 3 if rs.RecordCount <= 0 then rs.Close vg.Admin_TraceLogAdd iLineId, 5, "no records retrieved" else iAdID = rs.Fields("AdID").Value sFilename = rs.Fields("Filename").Value iPlayCount = rs.Fields("PlayCount").Value dateLastPlayTime = rs.Fields("LastPlayTime").Value rs.Close sSQL = "UPDATE AdList SET PlayCount=" & iPlayCount & ", LastPlayTime=" & strDateTimeNow & " WHERE AdID=" & iAdID vg.Admin_TraceLogAdd iLineId, 5, "sql=[" & sSQL & "]" cn.Execute sSQL sSQL = "INSERT INTO PlayLog (AdID, CallID, PlayDateTime, PlayedFrom) VALUES (" & iAdID & ", 0, " & strDateTimeNow & ", 'AnswerCall')" vg.Admin_TraceLogAdd iLineId, 5, " sql=[" & sSQL & "]" cn.Execute sSQL end if cn.Close set rs = Nothing set cn = Nothing set vg = Nothing WScript.Quit Share this post Link to post
SupportTeam Report post Posted 09/24/2006 09:32 AM retrieves data from the web database What do you mean by "Web Database" ? Are you referring to some web service which is used to retrieve data from a database? (There is an example for that in the Help file's entry on VBScript module). Share this post Link to post
Guest fsoudbakhsh Report post Posted 09/27/2006 05:22 AM No it is not a web services. It is my own database (Access database) that I have upload in my website and know I want to retrieve specific data from it. The sample you have in help file is just to read the last record in database which has been sorted. I need to use select command and where clause to retriever the specific data I want. Share this post Link to post
SupportTeam Report post Posted 09/27/2006 05:36 AM It is my own database (Access database) that I have upload in my website and know I want to retrieve specific data from it.Not sure how you could work with a database like that. You may want to speak to a Web Designer to see how you can retrieve information from such databases... Share this post Link to post