谁能解释这个错误? [英] can anyone explain this error?
问题描述
这是错误
< img src =http://i1248.photobucket.com/albums/hh498/tsenilas/wtf.jpg\"border =0alt =Photobucket/>
这里是代码。
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>
推荐答案
错误信息非常清楚 - 如果您学会使用复制和粘贴,它会有很大帮助文本,而不是拍摄屏幕截图并发布链接。
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"
检查你的连接字符串。尝试在VS中使用服务器资源管理器窗格设置连接:
1)打开服务器资源管理器。
2)右键单击数据连接并选择添加连接
3)在随后的对话框中,选择您的数据源和数据库,指定安全信息,然后按测试连接按钮。
4)连接工作时,按确定
5)在服务器资源管理器窗格中突出显示数据库,然后查看属性窗格。将显示连接字符串的工作示例,您可以将其复制并粘贴到您的应用程序或配置文件中。
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.
这篇关于谁能解释这个错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!