shlvy Posted August 24, 2004 Posted August 24, 2004 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. Quote
Administrators PlausiblyDamp Posted August 24, 2004 Administrators Posted August 24, 2004 Did you read the post http://www.xtremedotnettalk.com/showthread.php?t=87821? You are missing your security information - are you using windows or SQL authentication? What is the name of the SQL server, the name of the database? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
shlvy Posted August 24, 2004 Author Posted August 24, 2004 Hi I use windows authentication. SQL Server Name:IBM. DataBase Name:GuestBook. Thank's. Quote
Administrators PlausiblyDamp Posted August 24, 2004 Administrators Posted August 24, 2004 Data Source=IBM;Initial Catalog=GuestBook;Integrated Sucurity=true if that doesn't work could you say exactly what errors you are getting? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
shlvy Posted August 24, 2004 Author Posted August 24, 2004 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. Quote
Administrators PlausiblyDamp Posted August 24, 2004 Administrators Posted August 24, 2004 You will need to grant the ASPNET user access to the GuestBook database within SQL. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
shlvy Posted August 24, 2004 Author Posted August 24, 2004 Hi Thank's for your quick reply but how can i do that? Thank's. Quote
shlvy Posted August 24, 2004 Author Posted August 24, 2004 Hi Someone please can tell me how can i grant the ASPNET user access to the database within SQL. Thank's, it's very important. Quote
Arch4ngel Posted August 24, 2004 Posted August 24, 2004 -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 Quote "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
shlvy Posted August 24, 2004 Author Posted August 24, 2004 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. Quote
Arch4ngel Posted August 24, 2004 Posted August 24, 2004 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) ? Quote "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
shlvy Posted August 24, 2004 Author Posted August 24, 2004 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. Quote
Administrators PlausiblyDamp Posted August 24, 2004 Administrators Posted August 24, 2004 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? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
shlvy Posted August 24, 2004 Author Posted August 24, 2004 Hi Where can i see the security and logins? Thank's. Quote
Administrators PlausiblyDamp Posted August 24, 2004 Administrators Posted August 24, 2004 Use SQL Enterprise manager - it should have been installed along with SQL. If you can't find it how did you mamange to follow Arch4ngel's instructions? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
shlvy Posted August 24, 2004 Author Posted August 24, 2004 Hi I have enterprise manager, where in it? Quote
Administrators PlausiblyDamp Posted August 24, 2004 Administrators Posted August 24, 2004 Expand the top tree node, then expand the 'SQL Server Group', then expand your server You should see security as a node. Expand security and click on Logins. Do you see a user called IBM\ASPNET? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
shlvy Posted August 24, 2004 Author Posted August 24, 2004 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. Quote
Arch4ngel Posted August 24, 2004 Posted August 24, 2004 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) Quote "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
Administrators PlausiblyDamp Posted August 24, 2004 Administrators Posted August 24, 2004 You will need to install either SQL server or MSDE on the server and use a connection string similar to the one you are currently using. SQL does not have a path to a physical file as such. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.