Link to home
Start Free TrialLog in
Avatar of Waynebebay
Waynebebay

asked on

New to SQL server help me!!

Ok here is what I want to do and what I have done already.

Want to do:

I want to be able to write .asp pages with sql statements to create and drop tables.

What I have done:

I have a windows 2000 server running, with IIS on it, and MS SQL server 2000.

The problem:

Dont know where to begin to setup a connection to a database from a .asp file and the how to create the tables. I tried figuring out how to connect to the database but it didnt go so well. help me.
SOLUTION
Avatar of arbert
arbert

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Waynebebay
Waynebebay

ASKER

here is what i get


Error Type:
Microsoft OLE DB Provider for SQL Server (0x80004005)
Login failed for user 'dbo'. Reason: Not associated with a trusted SQL Server connection.
/justin/create.asp, line 7


i dont think i know the user name and password. I thought it was  user = dbo   pw = sa    for the northwind database.  where can I change the user and password? and dont i have to do some stuff with ODBC and IIS before i can connect with this code?
dbo stands for database owner--it's not really a user......sa is the "system administrator" account......

you can open enterprise manager.  Then either go to security, or expand your database and go to users.  If you want to create a new login, go to security and add the login--you can also assign the database permissions when you add the user.

You also need to right click on your server (in enterprise manager) and choose properties.  Click on the security tab and make sure you have "SQL Server and Windows" selected for the security mode.  If you don't have this selected, you have to setup the IIS account with rights on the database....
ok i did exactly what you told me to do. i added the users SERVER001\Administrator

I tried it again with that username and password it did not work. I used the user name Administrator, and SERVER001\Administrator. with the password that I put somewhere in IIS if forgot and tried a blank password.

does the computer have to be on a domain or be a domain controller maybe?
No, if you setup to use Windows and SQL authentication, it doesn't have to be on the same domain...and you got a login failed error above, so we know IIS is talking to SQL Server.

paste the connection string you used (stip the password out)
I used the one posted above the guy gave to me....i dont know if the password is right, i will change the windows administrator password and try again. if i dont post it is fixed then it didnt work.

DbConnectionStr = "ProvIDer=SQLOLEDB.1;Password=;Persist Security Info=True;User ID=Administrator;Initial Catalog=Northwind;Data Source=192.168.1.103"


  Set c_objConn = Server.CreateObject("ADODB.Connection")
  c_objConn.Open dbConnectionStr

sql="create table test (column1 varchar(100),column2 int)"

c_objconn.execute(sql)


Error Type:
Microsoft OLE DB Provider for SQL Server (0x80040E4D)
Login failed for user 'Administrator'.
/justin/create.asp, line 7





Hi

I would recommend reading a good tutorial on ASP Databases & ADO

here is one that i feel would answer many of your questions and give you a good insight

cheers

Len

http://www.4guysfromrolla.com/webtech/faq/Databases/faq1.shtml
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thanks that worked. im splitting the points cause he helped with the create tables
"Forget anything you have done so far just do this to the letter."

nice...