暫無描述
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

SQL_Module.vb 1.2KB

12345678910111213141516171819202122232425
  1. Imports System.Data.SqlClient
  2. Imports System.IO
  3. Module SQL_Module
  4. Public ConString, ConString2, SQL1 As String
  5. Public conn As New SqlConnection
  6. Public cmd As New SqlCommand
  7. Public dr As SqlDataReader
  8. Public da As New SqlDataAdapter
  9. Friend Sub ConnOpen()
  10. conn.Close() : If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  11. End Sub
  12. Friend Sub ConnOpen_工程圖庫SQL()
  13. conn.Close() : If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString2 : conn.Open() : End If
  14. End Sub
  15. Friend Sub CmdSet_For_DGV()
  16. cmd.Connection = conn : cmd.CommandText = SQL1 : da.SelectCommand = cmd
  17. End Sub
  18. Friend Sub CmdSet_For_dr()
  19. cmd.CommandText = SQL1 : cmd.Connection = conn : dr = cmd.ExecuteReader
  20. End Sub
  21. Friend Sub CmdSet_For_dr_pic()
  22. Dim fs As FileStream : fs = File.OpenRead(PA49) : Dim picb(fs.Length) As Byte : fs.Read(picb, 0, fs.Length) : fs.Close() : cmd.Parameters.Clear()
  23. cmd.CommandText = SQL1 : cmd.Parameters.Add("@binary_file", SqlDbType.VarBinary).Value = picb : cmd.Connection = conn : dr = cmd.ExecuteReader
  24. End Sub
  25. End Module