Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
here is the error
 
<img src="http://i1248.photobucket.com/albums/hh498/tsenilas/wtf.jpg" border="0" alt="Photobucket"/>
 

here are the codes.
 
    Private Sub btnAddDoc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAddDoc.Click
        If txtDocID.Text = "" OrElse txtDocName.Text = "" OrElse txtDocType.Text = "" Then
 
            lblNotice.Text = "PLEASE COMPLETE ALL THE REQUIRED FIELDS!!!"
        Else
            If btnAddDoc.Text = "Add Document" Then
                Dim connstring As String = "Provider=SQLOLEDB;Data Source=RONALDAMIT-PC;Integrated Security=SSPI;Initial Catalog=UEP Document Logbook"
 
                Dim conn As New ADODB.Connection()
                conn.ConnectionString = connstring
                conn.Open(Nothing, Nothing, Nothing, -1)
 
                Dim rs As New ADODB.Recordset()
 
                Dim sql As String = "Insert into AddDocument (DocID,DocName,Doctype) values ('" + txtDocID.Text + "', '" + txtDocName.Text + "', '" + txtDocType.Text + "')"
 
                rs.Open(sql, conn, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockReadOnly, -1)
 
                MessageBox.Show("Document Added")
            End If
        End If
    End Sub>
		
Posted 6-Dec-12 2:59am
Edited 6-Dec-12 3:01am
v2

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

The error message is pretty clear - and it would help a lot if you learn to use copy and paste of text rather than taking a screen shot and posting a link to that.
 
"Cannot open database UEP Document Logbook as requested by the login"
Check your connection string. Try setting up a connection in VS with the Server Explorer pane:
1) Open Server Explorer.
2) Right click "Data connections" and select "Add connection"
3) In the dialog that follows, select your DataSource, and database, specify the security info, and press the "Test connection" button.
4) When the connection works, press "OK"
5) Highlight your database in the Server Explorer pane, and look at the Properties pane. A working example of the connection string will be shown, which you can copy and paste into your app or config file.
  Permalink  
Comments
Ronald Amit at 6-Dec-12 13:22pm
   
I keep getting an "Error 26" every time I try to do you instruction number 1.. what do I do?
Ronald Amit at 6-Dec-12 13:32pm
   
it says Cannot connect to RONALDAMIT-PC/SQLEXPRESS.. a few weeks ago I have been using this database engine.. and now it just wont work..
OriginalGriff at 6-Dec-12 14:00pm
   
Assuming you have fixed the "Error 26" problem (or you wouldn't have posted your second message)
If it can't connect to "RONALDAMIT-PC/SQLEXPRESS" then probably, you have spelled it wrong. Open Sql Server Management Studio (SSMS for short) and look at the server name it defaults to on the login screen.
Ronald Amit at 6-Dec-12 21:36pm
   
that is the default server name the "RONALDAMIT-PC/SQLEXPRESS"
OriginalGriff at 7-Dec-12 3:42am
   
And did SSMS connect ok? If so, what login info did you use?
Ronald Amit at 7-Dec-12 12:36pm
   
No, it did not. it gave me the "Error 26"
OriginalGriff at 7-Dec-12 14:02pm
   
Then the name is wrong.
SQL Error 26 is "Error Locating Server/Instance Specified" - so try browsing for network versions via the startup Connect screen to at least pickup the name of the pc hosting the service.
Ronald Amit at 8-Dec-12 19:40pm
   
okay, its connected now. i just clicked the browse option and found another server without the "SQLEXPRESS" .. but I'm still getting the same errors.. what now?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web02 | 2.8.140709.1 | Last Updated 6 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid