iEntry 10th Anniversary Webforumz RegistrationAnnouncements Contact Webforumz StaffContact
Home Resources Blogs Meet the Team Contact Register
 

Go Back   WebForumz.com > The Code > Classic ASP

Reply
 
LinkBack Thread Tools
Old September 24th, 2007, 01:44 PM   #1
Elite Veteran
 

Join Date: Jul 2007
Location: Webforumz 24/7
Age: 16
Posts: 3,800
Blog Entries: 9
Thanks: 2
Thanked 3 Times in 3 Posts
Rep Altering Power: 0 alexgeek is a name known to all alexgeek is a name known to all alexgeek is a name known to all alexgeek is a name known to all alexgeek is a name known to all alexgeek is a name known to all
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:
Code:
mysql_query("SELECT * FROM table_name") or die (mysql_error()); 
And how to setup Microsoft SQL Server Accounts to connect?
couldn't find any info on how to do this.
__________________
Web Design and Development Blog

Alex Perry
Technical Administrator.
alexgeek is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old September 27th, 2007, 07:24 PM   #2
Most Reputable Member
 
spinal007's Avatar
 

Join Date: Mar 2004
Location: Good Ol'London
Age: 24
Posts: 1,683
Blog Entries: 1
Thanks: 1
Thanked 4 Times in 4 Posts
Rep Altering Power: 0 spinal007 has a spectacular aura about spinal007 has a spectacular aura about
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
__________________
Diego - Web-Developer & London SEO Expert
jQuery Plugins: Multiple File Upload, Star Rating, FCKEditor | NEW: XML to JSON
spinal007 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old September 27th, 2007, 07:44 PM   #3
Elite Veteran
 

Join Date: Jul 2007
Location: Webforumz 24/7
Age: 16
Posts: 3,800
Blog Entries: 9
Thanks: 2
Thanked 3 Times in 3 Posts
Rep Altering Power: 0 alexgeek is a name known to all alexgeek is a name known to all alexgeek is a name known to all alexgeek is a name known to all alexgeek is a name known to all alexgeek is a name known to all
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
__________________
Web Design and Development Blog

Alex Perry
Technical Administrator.
alexgeek is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old September 28th, 2007, 04:12 AM   #4
Most Reputable Member
 
spinal007's Avatar
 

Join Date: Mar 2004
Location: Good Ol'London
Age: 24
Posts: 1,683
Blog Entries: 1
Thanks: 1
Thanked 4 Times in 4 Posts
Rep Altering Power: 0 spinal007 has a spectacular aura about spinal007 has a spectacular aura about
Re: Querying Microsoft SQL server 2005

Alex, do you know anything about MSSQL or MySQL?
__________________
Diego - Web-Developer & London SEO Expert
jQuery Plugins: Multiple File Upload, Star Rating, FCKEditor | NEW: XML to JSON
spinal007 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old September 28th, 2007, 05:11 AM   #5
WebForumz Member
 

Join Date: Sep 2007
Location: Wales, UK
Age: 37
Posts: 91
Thanks: 1
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 robbied72 will become famous soon enough robbied72 will become famous soon enough
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?
robbied72 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old September 28th, 2007, 05:13 AM   #6
WebForumz Member
 

Join Date: Sep 2007
Location: Wales, UK
Age: 37
Posts: 91
Thanks: 1
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 robbied72 will become famous soon enough robbied72 will become famous soon enough
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.
robbied72 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old September 28th, 2007, 05:23 AM   #7
Most Reputable Member
 
spinal007's Avatar
 

Join Date: Mar 2004
Location: Good Ol'London
Age: 24
Posts: 1,683
Blog Entries: 1
Thanks: 1
Thanked 4 Times in 4 Posts
Rep Altering Power: 0 spinal007 has a spectacular aura about spinal007 has a spectacular aura about
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.
__________________
Diego - Web-Developer & London SEO Expert
jQuery Plugins: Multiple File Upload, Star Rating, FCKEditor | NEW: XML to JSON
spinal007 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old September 28th, 2007, 05:44 AM   #8
Most Reputable Member
 

Join Date: Feb 2004
Location: Borneo
Age: 28
Posts: 1,629
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Rep Altering Power: 0 Monie is a jewel in the rough Monie is a jewel in the rough Monie is a jewel in the rough Monie is a jewel in the rough
Re: Querying Microsoft SQL server 2005

Maybe this will help.

ConnectionString
Monie is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old September 28th, 2007, 12:52 PM   #9
Elite Veteran
 

Join Date: Jul 2007
Location: Webforumz 24/7
Age: 16
Posts: 3,800
Blog Entries: 9
Thanks: 2
Thanked 3 Times in 3 Posts
Rep Altering Power: 0 alexgeek is a name known to all alexgeek is a name known to all alexgeek is a name known to all alexgeek is a name known to all alexgeek is a name known to all alexgeek is a name known to all
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
__________________
Web Design and Development Blog

Alex Perry
Technical Administrator.
alexgeek is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old September 28th, 2007, 01:03 PM   #10
Most Reputable Member
 
spinal007's Avatar
 

Join Date: Mar 2004
Location: Good Ol'London
Age: 24
Posts: 1,683
Blog Entries: 1
Thanks: 1
Thanked 4 Times in 4 Posts
Rep Altering Power: 0 spinal007 has a spectacular aura about spinal007 has a spectacular aura about
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
__________________
Diego - Web-Developer & London SEO Expert
jQuery Plugins: Multiple File Upload, Star Rating, FCKEditor | NEW: XML to JSON
spinal007 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old September 28th, 2007, 01:09 PM   #11
Elite Veteran
 

Join Date: Jul 2007
Location: Webforumz 24/7
Age: 16
Posts: 3,800
Blog Entries: 9
Thanks: 2
Thanked 3 Times in 3 Posts
Rep Altering Power: 0 alexgeek is a name known to all alexgeek is a name known to all alexgeek is a name known to all alexgeek is a name known to all alexgeek is a name known to all alexgeek is a name known to all
Re: Querying Microsoft SQL server 2005

Quote:
Originally Posted by spinal007 View Post
"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
I've got that.
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.
__________________
Web Design and Development Blog

Alex Perry
Technical Administrator.
alexgeek is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old September 29th, 2007, 09:04 AM   #12
Most Reputable Member
 
spinal007's Avatar
 

Join Date: Mar 2004
Location: Good Ol'London
Age: 24
Posts: 1,683
Blog Entries: 1
Thanks: 1
Thanked 4 Times in 4 Posts
Rep Altering Power: 0 spinal007 has a spectacular aura about spinal007 has a spectacular aura about
Re: Querying Microsoft SQL server 2005

Google is your best friend.
__________________
Diego - Web-Developer & London SEO Expert
jQuery Plugins: Multiple File Upload, Star Rating, FCKEditor | NEW: XML to JSON
spinal007 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old September 29th, 2007, 09:09 AM   #13
Elite Veteran
 

Join Date: Jul 2007
Location: Webforumz 24/7
Age: 16
Posts: 3,800
Blog Entries: 9
Thanks: 2
Thanked 3 Times in 3 Posts
Rep Altering Power: 0 alexgeek is a name known to all alexgeek is a name known to all alexgeek is a name known to all alexgeek is a name known to all alexgeek is a name known to all alexgeek is a name known to all
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:
Parameters


servername The MS SQL server. It can also include a port number. e.g. hostname,port.
username The username.
password The password.
new_link If a second call is made to mssql_connect() with the same arguments, no new link will be established, but instead, the link identifier of the already opened link will be returned. This parameter modifies this behavior and makes mssql_connect() always open a new link, even if mssql_connect() was called before with the same parameters.
__________________
Web Design and Development Blog

Alex Perry
Technical Administrator.
alexgeek is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old September 29th, 2007, 10:03 AM   #14
Most Reputable Member
 
spinal007's Avatar
 

Join Date: Mar 2004
Location: Good Ol'London
Age: 24
Posts: 1,683
Blog Entries: 1
Thanks: 1
Thanked 4 Times in 4 Posts
Rep Altering Power: 0 spinal007 has a spectacular aura about spinal007 has a spectacular aura about
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.
__________________
Diego - Web-Developer & London SEO Expert
jQuery Plugins: Multiple File Upload, Star Rating, FCKEditor | NEW: XML to JSON
spinal007 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old September 29th, 2007, 10:28 PM   #15
Elite Veteran
 

Join Date: Jul 2007
Location: Webforumz 24/7
Age: 16
Posts: 3,800
Blog Entries: 9
Thanks: 2
Thanked 3 Times in 3 Posts
Rep Altering Power: 0 alexgeek is a name known to all alexgeek is a name known to all alexgeek is a name known to all alexgeek is a name known to all alexgeek is a name known to all alexgeek is a name known to all
Re: Querying Microsoft SQL server 2005

will try that and get back to you
__________________
Web Design and Development Blog

Alex Perry
Technical Administrator.
alexgeek is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
question about querying 2 databases in php sudhakararaog PHP 1 March 11th, 2008 05:33 PM
Trouble connecting to Sql Server 2005 Management Studio Express? annawilsonz Databases 0 September 14th, 2007 03:30 AM
Multi user support for SQL Server Express 2005 ish Databases 1 May 9th, 2007 01:51 PM
Querying Dates Steve Mellor Databases 1 April 13th, 2007 11:59 AM
Form Element has no properties when querying antonyx JavaScript 13 August 25th, 2006 11:06 AM


Search Engine Optimization by vBSEO 3.2.0 RC8