This is a discussion on "Querying Microsoft SQL server 2005" within the Classic ASP section. This forum, and the thread "Querying Microsoft SQL server 2005 are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
Querying Microsoft SQL server 2005
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
#1
|
||||
|
||||
|
Querying Microsoft SQL server 2005
How do I do this with ASP.
I know how to do queries (SELECT * FROM whatever) but how do I do this in ASP, another words the equivalent of:
couldn't find any info on how to do this.
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
|
|
|
|
#2
|
||||
|
||||
|
Re: Querying Microsoft SQL server 2005
the SQL doesn't change. what changes is how you connect to and retrieve the stuff from the database. The particular php code you have above connects to the local MySQL server (I believe).
In ASP, you will need to a) create a recordset b) connect to the database with a connection string c) run your query d) disconnect from the database something like this: Dim rs Set rs = Server.CreateObject("ADODB.Recordset") rs.ActiveConnection = " YOUR CONNECTION STRING HERE " rs.Open " YOUR SQL HERE ", , adOpenForwardOnly, adLockReadOnly Set rs.ActiveConnection = Nothing That should get you started. Play with it and let me know how you get on... Ps.: I typed this code straight in so forgive me if I make a mistake
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
|
|
#3
|
||||
|
||||
|
Re: Querying Microsoft SQL server 2005
how do i find my connection string?
i don't know how to set up account thanks for replying
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
|
|
#4
|
||||
|
||||
|
Re: Querying Microsoft SQL server 2005
Alex, do you know anything about MSSQL or MySQL?
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
|
|
#5
|
|||
|
|||
|
Re: Querying Microsoft SQL server 2005
Here's a MSSQL 2005 connection string -
MM_connDN_STRING = "Provider=MSDASQL; Driver={SQL Server}; Server=SERVERNAME_OR_IP_ADDRESS; Database=DATABASE_NAME; User ID=DATABASE_USERNAME; Password='PASSWORD';" Are you using Dreamweaver or are you hand coding? |
|
#6
|
|||
|
|||
|
Re: Querying Microsoft SQL server 2005
if you are just learning ASP i would suggest cutting your teeth using MS Access and then change the DB and connection string when you know how MS SQL is setup with users and permissions.
|
|
#7
|
||||
|
||||
|
Re: Querying Microsoft SQL server 2005
As Robbie suggested, if you're just starting off you're better off playing around with Access.
Once you've grasped the concepts of databases you can start using 'real' databases like MSSQL & MySQL.
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
|
|
#8
|
|||
|
|||
|
Re: Querying Microsoft SQL server 2005
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
|
|
#9
|
||||
|
||||
|
Re: Querying Microsoft SQL server 2005
No i can query mysql fine with PHP.
But i wanted to use an mssql database for use with PHP, ASP.NET and C# that way i can have a multplatform program. What i really need help with is setting up mssql accounts. I don't know how to do it
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
|
|
#10
|
||||
|
||||
|
Re: Querying Microsoft SQL server 2005
"setting up mssql accounts" doesn't really explain it well.
Do you mean setting up a hosting account with a hosting company that offers MS hosting and MS SQL databases? - OR - Do you mean installing MSSQL Server on your machine and creating databases? Either way, you will need this: Microsoft SQL Server: SQL Server 2005 Express Edition
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
|
|
#11
|
||||
|
||||
|
Re: Querying Microsoft SQL server 2005
Quote:
okay, you know in mySQL you need to use mysql_connect() with your host, username and password. How do you do that with mssql? I want to know how to connect to the mssql database which is on my server, via PHP.
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
|
|
#12
|
||||
|
||||
|
Re: Querying Microsoft SQL server 2005
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
|
|
#13
|
||||
|
||||
|
Re: Querying Microsoft SQL server 2005
That's what I've been trying to do.
But i don't know how to find this out: Quote:
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
|
|
#14
|
||||
|
||||
|
Re: Querying Microsoft SQL server 2005
server name - "(local)"
username and password - depends on what you chose when you installed your server. The default may be username "sa" with an empty password. If you can't work it out, get MSSQL 2005 Management Studio Express and create yourself a login. The program itself will use Windows authentication to access the database so you won't need username/password to use it.
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
|
|
#15
|
||||
|
||||
|
Re: Querying Microsoft SQL server 2005
will try that and get back to you
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
|
![]() |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| question about querying 2 databases in php | sudhakararaog | PHP Forum | 1 | Mar 11th, 2008 19:33 |
| Trouble connecting to Sql Server 2005 Management Studio Express? | annawilsonz | Databases | 0 | Sep 14th, 2007 06:30 |
| Multi user support for SQL Server Express 2005 | ish | Databases | 1 | May 9th, 2007 16:51 |
| Querying Dates | Steve Mellor | Databases | 1 | Apr 13th, 2007 14:59 |
| Form Element has no properties when querying | antonyx | JavaScript Forum | 13 | Aug 25th, 2006 14:06 |