帮忙看1下到底错哪里啦
Public Class Form1
Inherits System.Windows.Forms.Form
Private strConn As String = "user id=sa;data source=SU;persist security info=False;initial catalog=Northwind"
Private Conn As SqlClient.SqlConnection = New System.Data.SqlClient.SqlConnection(strConn)
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents DataGrid1 As System.Windows.Forms.DataGrid
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents Button2 As System.Windows.Forms.Button
Friend WithEvents Button3 As System.Windows.Forms.Button
Friend WithEvents Button4 As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.DataGrid1 = New System.Windows.Forms.DataGrid
Me.Button1 = New System.Windows.Forms.Button
Me.Button2 = New System.Windows.Forms.Button
Me.Button3 = New System.Windows.Forms.Button
Me.Button4 = New System.Windows.Forms.Button
CType(Me.DataGrid1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'DataGrid1
'
Me.DataGrid1.DataMember = ""
Me.DataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText
Me.DataGrid1.Location = New System.Drawing.Point(56, 32)
Me.DataGrid1.Name = "DataGrid1"
Me.DataGrid1.Size = New System.Drawing.Size(440, 176)
Me.DataGrid1.TabIndex = 0
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(80, 248)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(72, 24)
Me.Button1.TabIndex = 1
Me.Button1.Text = "View"
'
'Button2
'
Me.Button2.Location = New System.Drawing.Point(184, 248)
Me.Button2.Name = "Button2"
Me.Button2.Size = New System.Drawing.Size(64, 24)
Me.Button2.TabIndex = 2
Me.Button2.Text = "Add"
'
'Button3
'
Me.Button3.Location = New System.Drawing.Point(288, 248)
Me.Button3.Name = "Button3"
Me.Button3.Size = New System.Drawing.Size(64, 24)
Me.Button3.TabIndex = 3
Me.Button3.Text = "Update"
'
'Button4
'
Me.Button4.Location = New System.Drawing.Point(392, 248)
Me.Button4.Name = "Button4"
Me.Button4.Size = New System.Drawing.Size(64, 24)
Me.Button4.TabIndex = 4
Me.Button4.Text = "Delete"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(536, 309)
Me.Controls.Add(Me.Button4)
Me.Controls.Add(Me.Button3)
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.DataGrid1)
Me.MaximizeBox = False
Me.Name = "Form1"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "Form1"
CType(Me.DataGrid1, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub DataGrid1_Navigate(ByVal sender As System.Object, ByVal ne As System.Windows.Forms.NavigateEventArgs)
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'DataGrid init
'Database connect
On Error GoTo ErrHandle
Conn.Open()
ErrHandle:
MsgBox(Err.Description + "Database connection Error!!")
End Sub
End Class
为什么总联不上去呢?
问题点数:15、回复次数:3Top
1 楼lovefootball(蟑螂(生活就是扯淡--做人要放低姿态))回复于 2005-06-02 12:26:00 得分 5
connection string 的问题Top
2 楼zhangzhijian(逍遥||淡水鱼)回复于 2005-06-02 14:06:44 得分 5
strSql="Integrated Security=SSPI; Initial Catalog=dtaDatabaseName;Data Source=computername;Workstation ID=computername"Top
3 楼ferrari1231()回复于 2005-06-02 14:19:33 得分 5
strSql="Integrated Security=SSPI; Initial Catalog=dtaDatabaseName;Data Source=数据库存放的主机名或ip地址;Workstation ID=computername"
Top




