Option Explicit On
Imports System.Data
Imports System.Data.SqlClient
Imports System.Transactions
Imports System.Text
Module Module1
'===============ชุดตัวแปรที่เอาไว้เชื่อมต่อฐานข้อมูล===============
Public Conn As New SqlConnection(strCon)
Public Com As New SqlCommand()
Public strCon As String = "Data Source=HOME-PC\SQLSERVER;Initial Catalog=MusicTreading;Integrated Security=True"
Public ds As New DataSet()
Public sb As New StringBuilder()
Public Sql As String
Public reader As SqlDataReader
Public Sub dbOpen()
With Conn
If .State = ConnectionState.Open Then .Close()
.ConnectionString = strCon
.Open()
End With
End Sub
End Module
Tag : .NET, Ms SQL Server 2008
Date :
2012-05-16 22:15:46
By :
millanium2
View :
1163
Reply :
5
No. 1
Guest
Public Conn As New SqlConnection(strCon) ผมว่ามันควรประกาศ ไว้ล่าง
Public strCon As String = "Data Source=HOME-PC\SQLSERVER;Initial Catalog=MusicTreading;Integrated Security=True"
นะครับ เหมือนว่าพอ compile ไปแล้วมันจะไม่รู้จัก strCon