If Not Page.IsPostBack() Then
Dim StrConn As String = WebConfigurationManager.ConnectionStrings("conn").ConnectionString
Dim dt As New DataTable
Dim da1 As New System.Data.SqlClient.SqlDataAdapter("SELECT * FROM mode", StrConn)
da1.Fill(dt)
Dim LT As New ListItem
'LT.Text = "-- Select Mode --"
'LT.Value = ""
'mode.Items.Add(LT)
For i As Integer = 0 To dt.Rows.Count - 1
mode.Items.Add(New ListItem(dt.Rows(i).Item("mode"), dt.Rows(i).Item("id_mode")))
Next
End If
Gridbind()
End Sub
Sub Gridbind()
Dim strConn As String
Dim sqluername As String
Sub GridView1_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles GridView1.RowCommand
If e.CommandName = "Buy" Then
For Each gr As GridViewRow In Me.GridView1.Rows
If gr.RowType = DataControlRowType.DataRow Then
Dim tmpTextbox As TextBox = gr.Cells(5).FindControl("sale_num")
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentException: Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[ArgumentException: Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.]
System.Web.UI.ClientScriptManager.ValidateEvent(String uniqueId, String argument) +367
System.Web.UI.Control.ValidateEvent(String uniqueID, String eventArgument) +83
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +51
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +31
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +32
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +72
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3840
Server Error in '/' Application.
Login failed for user 'SMART_PRINT\ASPNET'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Login failed for user 'SMART_PRINT\ASPNET'.
Source Error:
Line 74: End With
Line 75: End If
Line 76: DBConnection.Open()
Line 77: End Sub
Line 78:
Version Information: Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.3053
Date :
2009-08-26 15:48:14
By :
ody
No. 5
Guest
ตัวนี้เป็นโค๊ดของหน้าที่มันฟ้อง error
Option Explicit On '--ทำหน้าที่กำหนดว่าตัวแปรทุกตัวที่คุณใช้งานต้องมีการประกาศการใช้งานก่อนทุกครั้ง
Option Strict On '--ทำหน้าที่กำหนดว่าการเปลี่ยนแปลงข้อมูลทุกชนิดจะใช้กติกาอย่างเข้มงวดและเคร่งครัด
'Imports System.Management
Imports Microsoft.VisualBasic
Imports System.Data
Imports System.Data.SqlClient
Public Class DBClass
Inherits System.Web.UI.Page
Private _ErrorStatus As String = Nothing '--เก็บค่า Error Message ในการ Connection Database--'
Private HostIP As String = Nothing '--เก็บค่า IP ของเครื่อง Host ที่เรียกใช้โปรแกรม
#Region "DBClass SQLServer"
Public Event onDBError(ByVal strError As String)
Public Event onSuccess(ByVal strMessage As String)
Private G_DBuser As String = "sa" '--เก็บค่า User Sqlserver
Private G_DBpassword As String = "" '--เก็บค่า Password Sqlserver
'--Connection SQL Server 2005---'
'Private G_STR_Connection As String = "Data Source=MNHHCIT903\SQL903;Initial Catalog=Mena_General;User ID=sa;Password=;"
'Private G_STR_Connection As String = "Data Source=Lee;Initial Catalog=Mena_General;User ID=" & G_DBuser & ";" & "Password=" & G_DBpassword & ";"
'---Private G_STR_Connection As String = System.Web.Configuration.WebConfigurationManager.ConnectionStrings("webconn").ConnectionString
'
'
'--Connection SQL Server 2000---'
Private G_STR_Connection As String = "Data Source=192.2.3.107;Initial Catalog=Mena_General;User ID=sa;Password=;Max Pool Size=200;Enlist=true;"
'
'
Public strSql As String = "" '--เก็บค่า String เพื่อส่งไป Query
'
'
Private DBConnection As SqlConnection
Private DBCommand As SqlCommand
Private DBAdapter As SqlDataAdapter
Public Shared Sub OpenConnection()
'xxxx
End Sub
Public Sub New()
Try
DBConnection = New SqlConnection(G_STR_Connection)
Catch ex As Exception
G_STR_Connection = "Data Source=192.2.2.199;Initial Catalog=Mena_General;User ID=sa;Password=;Enlist=false;"
DBConnection = New SqlConnection(G_STR_Connection)
End Try
DBCommand = New SqlCommand
DBCommand.Connection = DBConnection
DBAdapter = New SqlDataAdapter
End Sub
Public Sub New(ByVal con_close As Boolean)
'Do Nothing Cause Not open Connection
'เวลาเรียกใช้ ให้ Private WithEvents myDB As New DBClass(False)
End Sub
Public Sub New(ByVal DBname As String)
'---DB = New DBClass("Mena_Center") '--เริ่มเรียกใช้ Database
'If DBname.Length <> 0 Then
'DBConnection = New SqlConnection(G_STR_Connection & ";Initial Catalog=" & DBname)
'Else
'DBConnection = New SqlConnection(G_STR_Connection & ";Initial Catalog=Mena_Center")
'End If
DBCommand = New SqlCommand
DBCommand.Connection = DBConnection
DBAdapter = New SqlDataAdapter
End Sub
Private Sub OpenDB() ' Optional ByVal DBname As String = "") '--Close แล้ว Open connect datablase
_ErrorStatus = Nothing
If DBConnection IsNot Nothing Then
With DBConnection
.Close()
'.Dispose() '--คืนทรัพยากรในกับระบบ
End With
End If
DBConnection.Open()
End Sub
Public Sub CloseDB() '--Close connect datablase
DBConnection.Close()
Call ShowError()
End Sub
Private Sub Initial_DataBase(Optional ByVal DATABASE_Name As String = "Mena_center")
If Left(DATABASE_Name.ToUpper, 4) = "MENA" Then
G_STR_Connection = "Data Source=192.2.2.199;Initial Catalog=" & DATABASE_Name & ";User ID=sa;Password=;Enlist=false;"
Else
Select Case Left(DATABASE_Name.ToUpper, 5)
Case "CT"
G_STR_Connection = "Data Source=192.2.2.199;Initial Catalog=Mena_Center;User ID=sa;Password=;Enlist=false;"
Case "HR"
G_STR_Connection = "Data Source=192.2.2.199;Initial Catalog=Mena_HR;User ID=sa;Password=;Enlist=false;"
Case "OF"
G_STR_Connection = "Data Source=192.2.2.199;Initial Catalog=Mena_Office;User ID=sa;Password=;Enlist=false;"
Case "LE"
G_STR_Connection = "Data Source=192.2.2.199;Initial Catalog=Mena_Leasing;User ID=sa;Password=;Enlist=false;"
Case Else
If Right(Left(DATABASE_Name.ToUpper, 6), 3) = "GEN" Then
G_STR_Connection = "Data Source=192.2.2.199;Initial Catalog=Mena_General;User ID=sa;Password=;Enlist=false;"
Else
G_STR_Connection = "Data Source=192.2.2.199;Initial Catalog=Mena_Center;User ID=sa;Password=;Enlist=false;"
End If
End Select
End If
End Sub
Public Function GetDataSet(ByVal sSQL As String) As DataSet
Dim GDS As New DataSet
Try
Call OpenDB()
DBCommand.CommandText = sSQL
DBCommand.CommandTimeout = 6000 '-- Utian coding
DBAdapter.SelectCommand = DBCommand
DBAdapter.Fill(GDS)
Catch Ex As Exception
_ErrorStatus = "<Error Or Problem> พบปัญหาในการติดต่อฐานข้อมูล (GetDataSet)" & vbCr & vbCr & Ex.Message
'RaiseEvent onDBError(_ErrorStatus)
Finally
Call CloseDB()
End Try
Return GDS
End Function
Public Function GetSPDataSet(ByVal sSQL As String, Optional ByVal para As String = "", Optional ByVal DBname As String = "") As DataSet
Dim GDS As New DataSet
Dim arrStr() As String
'
'--เวลาใช้--'
'Ds = DB.GetSPDataSet("SP_ValidateUser", "@uname;M-240;@upassword;3361", "Mena_HR")
'จะได้
'.CommandText = sSQL
'.Parameters.Add(New SqlParameter("@uname", "M-240"))
'.Parameters.Add(New SqlParameter("@upassword", "3361"))
'
'หรือ แบบ 2 None parameter
'Ds = DB.GetSPDataSet("SP_GetDatetime","","Mena_Center")
'
'
If DBname.Length <> 0 Then
Call Initial_DataBase(DBname)
Else
Call Initial_DataBase(sSQL)
End If
DBConnection = New SqlConnection(G_STR_Connection)
Call OpenDB()
Try
With DBCommand
.CommandText = sSQL '---Stored Procedure to Call
If para <> "" Then
arrStr = Split(para, ";")
For i As Integer = 0 To arrStr.Length - 1 Step +2
.Parameters.Add(New SqlParameter(arrStr(i), arrStr(i + 1)))
Next
End If
.CommandTimeout = 6000 '-- Utian coding
.CommandType = CommandType.StoredProcedure '---Setup Command Type
.Connection = DBConnection
End With
DBAdapter.SelectCommand = DBCommand
DBAdapter.Fill(GDS)
Catch Ex As Exception
_ErrorStatus = "<Error Or Problem> พบปัญหาในการติดต่อฐานข้อมูล (GetSPDataSet)" & vbCr & vbCr & Ex.Message
Finally
Call CloseDB()
End Try
Return GDS
End Function
Public Function GetDataReader(ByVal sSQL As String) As SqlDataReader
Dim Gdr As SqlDataReader = Nothing
Call OpenDB()
Try
DBCommand = New SqlCommand(sSQL, DBConnection)
DBCommand.CommandTimeout = 6000 '-- Utian coding
Gdr = DBCommand.ExecuteReader()
Catch ex As Exception
_ErrorStatus = "<Error Or Problem> พบปัญหาในการติดต่อฐานข้อมูล (GetSPDataReader)" & vbCr & vbCr & ex.Message
End Try
'If Gdr.HasRows Then
' While Gdr.Read()
' MsgBox(Gdr(0).ToString())
' End While
'End If
'เมื่อ Return Gdr จะถูกปิดโดยอัตโนมัต ตัวแปลในระดับ Block
'fload.Close()
'fload.Dispose() '--มีหน้าที่คืน Unmanaged resource ทันที
Return Gdr
End Function
Public Function GetSPDataReader(ByVal sSQL As String, Optional ByVal para As String = "", Optional ByVal DBname As String = "") As SqlDataReader
Dim Gdr As SqlDataReader = Nothing
Dim arrStr() As String
If DBname.Length <> 0 Then
Call Initial_DataBase(DBname)
Else
Call Initial_DataBase(sSQL)
End If
DBConnection = New SqlConnection(G_STR_Connection)
Call OpenDB()
Try
With DBCommand
.CommandText = sSQL '---Stored Procedure to Call
If para <> "" Then
arrStr = Split(para, ";")
For i As Integer = 0 To arrStr.Length - 1 Step +2
.Parameters.Add(New SqlParameter(arrStr(i), arrStr(i + 1)))
Next
End If
.CommandTimeout = 6000 '-- Utian coding
.CommandType = CommandType.StoredProcedure '---Setup Command Type
.Connection = DBConnection
End With
Gdr = DBCommand.ExecuteReader()
Catch ex As Exception
_ErrorStatus = "<Error Or Problem> พบปัญหาในการติดต่อฐานข้อมูล (GetDataReader)" & vbCr & vbCr & ex.Message
End Try
Return Gdr
End Function
Public Function GetDataTable(ByVal sSQL As String) As DataTable
Dim GDT As New DataTable
Try
Call OpenDB()
DBCommand.CommandText = sSQL
DBCommand.CommandTimeout = 6000 '-- Utian coding
DBAdapter.SelectCommand = DBCommand
DBAdapter.Fill(GDT)
Catch Ex As Exception
_ErrorStatus = "<Error Or Problem> พบปัญหาในการติดต่อฐานข้อมูล (GetDataTable)" & vbCr & vbCr & Ex.Message
Finally
Call CloseDB()
End Try
Return GDT
End Function
Public Function GetSPDataTable(ByVal sSQL As String, Optional ByVal para As String = "", Optional ByVal DBname As String = "") As DataTable
Dim GDT As New DataTable
Dim arrStr() As String
If DBname.Length <> 0 Then
Call Initial_DataBase(DBname)
Else
Call Initial_DataBase(sSQL)
End If
DBCommand.Connection = DBConnection
Call OpenDB()
Try
With DBCommand
.CommandText = sSQL '---Stored Procedure to Call
If para <> "" Then
arrStr = Split(para, ";")
For i As Integer = 0 To arrStr.Length - 1 Step +2
.Parameters.Add(New SqlParameter(arrStr(i), arrStr(i + 1)))
Next
End If
.CommandTimeout = 6000 '-- Utian coding
.CommandType = CommandType.StoredProcedure '---Setup Command Type
.Connection = DBConnection
End With
DBAdapter.SelectCommand = DBCommand
DBAdapter.Fill(GDT)
Catch Ex As Exception
_ErrorStatus = "<Error Or Problem> พบปัญหาในการติดต่อฐานข้อมูล (GetSPDataTable)" & vbCr & vbCr & Ex.Message
Finally
Call CloseDB()
End Try
Return GDT
End Function
Public Function Execute(ByVal sSQL As String) As Boolean
'--วิธีเรียกใช้
'
'strSql = "Insert Into Mena_Center..XXX (CUS_CODE)values ('99')
'If DB.Execute(strSql) = True Then
' MB.DispSaveNewData()
' False มี Error
'End If
Dim Execute_Completes As Boolean = False
Try
Call OpenDB()
DBCommand.CommandText = sSQL
DBCommand.CommandTimeout = 6000 '-- Utian coding
DBCommand.ExecuteNonQuery()
RaiseEvent onSuccess("<Save Data Completes> บันทึกข้อมูล เรียบร้อย") '--Execute Success
Execute_Completes = True
Catch Ex As Exception
_ErrorStatus = "<Error Or Problem> พบปัญหาในการบันทึกข้อมูลลงฐานข้อมูล/หรือรหัสซ้ำ (Execute) " & vbCr & vbCr & Ex.Message
Execute_Completes = False
Finally
Call CloseDB()
End Try
Return Execute_Completes
End Function
Public Sub ExecuteStoredProc(ByVal sSQL As String)
'--Run a stored procedure that does not return records
Dim lngRecords As Integer = 0
Try
Call OpenDB()
DBCommand.CommandText = sSQL
DBCommand.CommandTimeout = 6000 '-- Utian coding
DBCommand.CommandType = CommandType.StoredProcedure
DBCommand.ExecuteNonQuery()
RaiseEvent onSuccess("<Save Data Completes> บันทึกข้อมูล เรียบร้อย") '--Execute Success
Catch Ex As Exception
_ErrorStatus = "<Error Or Problem> พบปัญหาในการบันทึกข้อมูลลงฐานข้อมูล (ExecuteStoredProc) " & vbCr & vbCr & Ex.Message
Finally
Call CloseDB()
End Try
End Sub
'Public Sub CreateParam(ByRef Cmd As OleDbCommand, ByVal StrType As String)
' 'T:Text, M:Memo, Y:Currency, D:Datetime, I:Integer, S:Single, B:Boolean
' Dim i As Integer
' Dim j As String
' For i = 1 To Len(StrType)
' j = UCase(Mid(StrType, i, 1))
' Dim P1 As New OleDbParameter()
' P1.ParameterName = "@P" & i
' Select Case j
' Case "T"
' P1.OleDbType = OleDbType.VarWChar
' Case "M"
' P1.OleDbType = OleDbType.LongVarWChar
' Case "Y"
' P1.OleDbType = OleDbType.Currency
' Case "D"
' P1.OleDbType = OleDbType.Date
' Case "I"
' P1.OleDbType = OleDbType.Integer
' Case "S"
' P1.OleDbType = OleDbType.Decimal
' Case "B"
' P1.OleDbType = OleDbType.Boolean
' End Select
' Cmd.Parameters.Add(P1)
' Next
'End Sub
#End Region '--DBClass SQLServer
#Region "CodeGenerator"
Public Function Gencode(ByVal comcode As String, ByVal orgcode As String, ByVal rectype As String) As String
Dim md As New MDClass
Dim GencodeTable As New DataTable
Dim runno As Integer
Dim YYYY As String
Dim Codegen As String = ""
If Year(Now) > 2500 Then
'--พ.ศ.
YYYY = (Year(Now) - 543).ToString.Trim
Else
'--ค.ศ
YYYY = Year(Now).ToString.Trim
End If
strSql = ""
strSql &= " Select RUN_NO "
strSql &= " ,RUN_DATE "
strSql &= " From Mena_General..GEN_MSRUNNINGNO "
strSql &= " Where COMP_CODE = '" & comcode & "'"
strSql &= " And ORG_CODE = '" & orgcode & "'"
strSql &= " And RUN_DOC_TYPE = '" & rectype & "'"
strSql &= " And RUN_DATE = '" & YYYY & "'"
Dim Dt As DataTable
Dt = GetDataTable(strSql)
If GetIsError = False AndAlso Dt.Rows.Count > 0 Then
runno = CInt(Dt.Rows(0)("RUN_NO"))
'YYYY = CStr(Dt.Rows(0)("RUN_DATE"))
runno += 1
'================================================
Codegen = rectype & Mid(YYYY, 3, 2) & Right("000000" & runno.ToString.Trim, 6)
'================================================
strSql = "" 'Update ตารางทันทีที่ทำการขอเลขเสร็จ
strSql &= " Update Mena_General..GEN_MSRUNNINGNO set "
strSql &= " RUN_NO = '" & runno & "',"
strSql &= " UPDATE_NAME = '" & Session("Emp_Update").ToString & "',"
strSql &= " UPDATE_DATE ='" & md.chkdate("MDY") & "' "
strSql &= " Where COMP_CODE = '" & comcode & "'"
strSql &= " And ORG_CODE = '" & orgcode & "'"
strSql &= " And RUN_DOC_TYPE = '" & rectype & "'"
Execute(strSql)
Else
Codegen = rectype & Right(YYYY, 2) & "000001"
strSql = "INSERT INTO Mena_General..GEN_MSRUNNINGNO "
strSql = strSql & "(COMP_CODE,ORG_CODE,RUN_DATE,"
strSql = strSql & "RUN_DOC_TYPE,RUN_NO,UPDATE_NAME,UPDATE_DATE) VALUES "
strSql = strSql & "( '" & comcode & " ','" & orgcode & "','" & YYYY & "','" & rectype & "',"
strSql = strSql & "'1', '" & Session("Emp_Update").ToString.Trim & "',' " & md.chkdate("MDY") & "') "
Execute(strSql)
End If
Return Codegen
End Function
'function for เลือกวันที่จาก เครื่อง server
Public Function Select_DateTimeServer() As String
Dim xx As String = ""
strSql = ""
strSql &= " Select Getdate()as xx"
Dim Dt As DataTable
Dt = GetDataTable(strSql)
If GetIsError = False AndAlso Dt.Rows.Count > 0 Then
xx = CStr(Dt.Rows(0).Item("xx"))
End If
Return xx
End Function
#End Region '---CodeGenerator
#Region "Others"
Public ReadOnly Property ErrorStatus() As String
'--แสดง Error Message ในการ Connection Database--'
Get
Return _ErrorStatus
End Get
End Property
Public ReadOnly Property GetIsError() As Boolean
'--ตรวจสอบ Error การ Connection Database--'
Get
Dim errmsg As Boolean = False
If Not Me._ErrorStatus Is Nothing Then
If Me._ErrorStatus.Length > 0 Then
errmsg = True
End If
End If
Return errmsg
End Get
End Property
Private Sub ShowError()
'--แสดง Message BOX Error การ Connection Database--'
If Not IsNothing(_ErrorStatus) Then
MsgBox(_ErrorStatus)
RaiseEvent onDBError(_ErrorStatus)
End If
End Sub
#End Region '---Others
#Region "GetIPAddress"
'Private Function GetIPAddress() As String '--แบบที่ 1
' Dim MyManagementClass As New ManagementClass("Win32_NetworkAdapterConfiguration")
' Dim MyManagementObjectCollection As ManagementObjectCollection = MyManagementClass.GetInstances()
' Dim MyManagementObject As ManagementObject
' Dim StrIP As String = ""
' For Each MyManagementObject In MyManagementObjectCollection
' If CBool(MyManagementObject.Item("IPEnabled").ToString) = True Then 'รับค่า IP
' Dim IP1() As String = CType(MyManagementObject.Item("IPAddress"), String())
' 'MessageBox.Show("ip address " & IP(0))
' 'MessageBox.Show("MAC address " & MyManagementObject.Item("MacAddress").ToString())
' 'GetIPAddress = IP(0)
' StrIP = IP1(0)
' Exit For
' Else
' StrIP = ""
' End If
' Next
' Return StrIP
'End Function
'Private Function GetIPAddress() As String '--แบบที่ 2
' Dim sHostName As String
' Dim i As Integer
' sHostName = System.Net.Dns.GetHostName()
' Dim ipE As System.Net.IPHostEntry = System.Net.Dns.GetHostEntry(sHostName)
' Dim IpA() As System.Net.IPAddress = ipE.AddressList
' For i = 0 To IpA.GetUpperBound(0)
' Console.Write("IP Address {0}: {1} ", i, IpA(i).ToString)
' Next
' Return IpA(0).ToString
'End Function
'Sub GetIPAddress() '--แบบที่ 3
' Dim myHost As String = System.Net.Dns.GetHostName()
' IP = System.Net.Dns.GetHostEntry(myHost).AddressList(0).ToString
' IP = Left(IP, 6) & ".0.1"
'End Sub
Public ReadOnly Property GetIP() As String
'--แสดง IP ของเครื่องที่เรียกใช้โปรแกรม--'
'G_HostIP = DB.GetIP '--เริ่มเรียกใช้
Get
'HostIP = GetIPAddress()
Return HostIP
End Get
End Property
#End Region '--"GetIPAddress"
#Region "USE"
'
'
'--ส่วนวิธีใช้ให้ประกาศobject ของ class DBClass แบบนี้
'Public Class Test
'-- แบบที่ 1 วางไว้ที่หัว Form (เรียก Database ทันที่)
' Private WithEvents DB As New DBClass
'
'-- แบบที่ 2 วางไว้ที่หัว Form (เรียก Database ภายหลัง)
' Private WithEvents DB As DBClass
' DB = New DBClass '--เรียก Database
' Private WithEvents คือ เป็นการสั่งให้ Object เพิ่ม Event เข้ามา เช่น เมื่อเขียน
' เช่น
' Private WithEvents oRS As New ADODB.Recordset
' แล้วไปที่ดูที่ ListBox ของ Object จะเห็น oRS เมื่อเลือกแล้วคลิกที่ ListBox ของ Event
' ก็จะเห็น Event ต่างๆ ให้เลือก Code ได้ แต่ถ้าไม่มี WithEvents เราจะไม่เห็น oRS ใน ListBox
'End Class
'
'
'--ส่วนวิธีใช้ก็
'Private Sub DBManager_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
' Dim DS As DataSet
' DS = DB.GetDataSet("select * from xxx")
' If DB.GetIsError = False Then
' '---
' End If
'
' หรือ
'
' Dim Dr As SqlClient.SqlDataReader
' Dr = DB.GetDataReader(strSql)
' If DB.GetIsError = False andalso dt.row.count > 0 Then
' If Dr.HasRows Then
' While Dr.Read()
' MsgBox("xx -->> " & Dr(0).ToString())
' End While
' End If
' End If
' Dr.Close()
'End Sub
'
'
'--การจับ Event ของ Class
'Private Sub onQueryError(ByVal strError As String) Handles myDB.onDBError
' MsgBox(strError)
'End Sub
'Private Sub onSuccess(ByVal strMessage As String) Handles myDB.onSuccess
' MsgBox(strMessage)
'End Sub
'
'If DB.GetIsError = True Then
' MsgBox(myDB.ErrorStatus)
'End If
'
#End Region '--"วิธีเรียกใช้ USE"