I have a windows webhosting and created a database, Anybody have a sample code for database connection from my asp page to my database server? Thanks in advance
ASP connection string <% Dim conn, rs Set conn=Server.CreateObject("ADODB.Connection") conn.Open "Provider=SQLOLEDB;server=<Your database serve IP Address>;Database=<your database name>;uid=<your username>;pwd=<your password>" set rs = Server.CreateObject("ADODB.RecordSet") %> Code (markup): Save this code in conn.asp page and upload in your wwwroot or html_public folder for test you need to run your website page http://www.domainname.com/conn.asp
I cannot connect in my server, i have this error. Microsoft OLE DB Provider for SQL Server error '80004005' [DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied. /free-cellphoneringtones.com/connect.asp, line 5 Is domainname Ip address different from Server Ip Address? Thanks
If you want more information in less time, check out the video tutorials from codervods.com , they also have about database conectivity
Instead of Server try data source conn.Open "Provider=SQLOLEDB; Data Source = <IP of the server>; Initial Catalog = <YourDatabase>; User Id = youruid; Password=yourpassword"
The problem is i used my server ip address, instead of my database ip, thats why its not working. But its working now, i tested and have good data output. Thanks evryone for your help appreciate it.