Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi

I have a simple problem.

I want to make a SQL Connection to my satabase but i got errors every time.

I use SQL SERVER 2000 and windows authentication, i write the next connection:

dim strConn as string ="Data Source=IBM;Initial Catalog=GuestBook"

Can someone write to me the full path connection?

Thank's.

Posted

Hi

I wrote:

dim strConn as string ="Data Source=IBM;Initial Catalog=GuestBook;Integrated Security=true".

The error is:

Login failed for user 'IBM\ASPNET'.

Thank's.

Posted

-Go in Enterprise Manager.

-Get into your DataBase

-Get into Users

-Right click in the right screen and select "New DataBase User..."

-In Login name... use <MACHINE_NAME>\ASPNET and give him a username

 

Now you can set his membership to some roles.

 

-Click OK

-Now if you right click on the user and go into "All task" you'll have "Manager Permissions..." which will give you more detailed choice of what he have access.

 

N.B.: If it's only read and write access to data... well... make him member of db_datareader and db_datawriter

"If someone say : "Die mortal !"... don't stay to see if he isn't." - Unknown

"Learning to program is like going out with a new girl friend. There's always something that wasn't mentioned in the documentation..." - Me

"A drunk girl is like an animal... it scream at everything like a cat and roll in the grass like a dog." - Me after seeing my girlfriend drunk and some of her drunk friend.

C# TO VB TRANSLATOR

Posted

Hi

Thank's for your reply but the error is still shown, i did what you told me.

I can see that there is another user<dbo>.

Maybe i have to do something in manage permission?

Thank's for your help.

Posted

Did you set your ASPNET to db_datareader and db_datawriter ? it will allow him to write to your DB.

 

And did you replace <MACHINE_NAME> with your own machine name(or the ASPNET's machine name) ?

"If someone say : "Die mortal !"... don't stay to see if he isn't." - Unknown

"Learning to program is like going out with a new girl friend. There's always something that wasn't mentioned in the documentation..." - Me

"A drunk girl is like an animal... it scream at everything like a cat and roll in the grass like a dog." - Me after seeing my girlfriend drunk and some of her drunk friend.

C# TO VB TRANSLATOR

Posted

Hi

I did all you said, but i still have the error.

When i click right click and properties i see in login name<None> and in the UserName<The right UserName>.

Maybe there i an error in my code:

There are 2 pages:

Sub Page_Load (Source As Object, E as EventArgs)

dim strConn as string ="Data Source=IBM;Initial Catalog=GuestBook;Integrated Security=true"

 

 

Dim MySQL as string = "SELECT Name, EMail, URL, Comment FROM Guestbook"

Dim MyConn as New SQLConnection (strConn)

Dim Cmd as New SQLCommand (MySQL, MyConn)

MyConn.Open ()

rptGuestbook.DataSource = Cmd.ExecuteReader(System.Data.CommandBehavior.CloseConnection)

rptGuestbook.DataBind()

End Sub

sub OnBtnSendClicked (s As Object, e As EventArgs)

dim strConn as string ="Data Source=IBM;Initial Catalog=GuestBook;Integrated Security=true"

 

Dim MySQL as string = "INSERT INTO Guestbook (Name, EMail, URL, Comment) VALUES ('" & txtName.Text & "','" & txtEMail.Text & "','" & txtURL.Text & "','" & txtComment.Text & "')"

Dim MyConn as New SQLConnection (strConn)

Dim cmd as New SQLCommand (MySQL, MyConn)

MyConn.Open ()

cmd.ExecuteNonQuery ()

MyConn.Close ()

 

Response.Redirect ("page.aspx")

end sub

Thank's.

  • Administrators
Posted

Did you follow Arch4ngel's steps exactly?

In SQL Enterprise manger under security, Logins you should now have a login for IBM\ASPNET - do you?

If so right click on it and bring up the property page - on the first tab is the authentication mode set to windows? (It will be greyed out but you should see it selected) And is Grant Access selected?

On the 3rd Tab (Database access) is ther ea tick in the box next to GuestBook? and if so what other roles are selected on the bottom half of the page?

Also is the SQL server on your machine or a remote one?

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Posted

Hi

Thank you very veru much, everything is works fine, i have only 2 questions:

1.Do i always use IBM/ASPNET, i mean to all applications that i will write?

2.When i have use access database i just upload the *.mdb file to the server(web) and write the phisical path, now is there anything to upload and what will be the path?

Thank you all.

Posted
When I write application... I always prefer to use SQL Authentication. That way... it don't depend on the machine, it depend of the BD. Within my application I use clear text username and password (because I didn't find a way to encrypt them :p)

"If someone say : "Die mortal !"... don't stay to see if he isn't." - Unknown

"Learning to program is like going out with a new girl friend. There's always something that wasn't mentioned in the documentation..." - Me

"A drunk girl is like an animal... it scream at everything like a cat and roll in the grass like a dog." - Me after seeing my girlfriend drunk and some of her drunk friend.

C# TO VB TRANSLATOR

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...