View: 3253|Reply: 11
|
Aku dilanda kebodohan dan kemalasan nak cari
[Copy link]
|
|
nak tanya sket... sapa leh bagi komen.. apa aku perlu buat..
ADO.net? or ODBC? or OLEDB?
- Imports System.Data.OleDb
- Public Class DB_Class
- Public tempDB As OleDbConnection
- Public Sub New()
- tempDB = New OleDbConnection(GetDatabaseName)
- End Sub
- Public Sub New(ByRef tDB As OleDbConnection, ByVal sDatabasePath As String)
- tDB = New OleDbConnection(sDatabasePath)
- End Sub
- 'Get Database Path/DSN
- Private Function GetDatabaseName() As String
- Return "C:\eReloadAdmin\Database\my_db.mdb"
- End Function
- 'Run query
- Public Function RunQuery(ByVal sSqlString As String) As Boolean
- Try
- 'Sangkut la pulok
- Catch ex As Exception
- End Try
- End Function
- 'Get Recordset
- Public Function RunRecordset(ByVal sSqlString As String) As Boolean
- Try
- 'Sangkut la pulok
- Catch ex As Exception
- End Try
- End Function
- End Class
Copy the Code |
|
|
|
|
|
|
|
FYI... aku baru dalam .NET... sblum nih vb6 je.. hheehhehe |
|
|
|
|
|
|
|
dapat mencari sket.. result code terbaru
- Imports System.Data.OleDb
- Public Class DB_Class
- Public tempDB As OleDbConnection
- Private oleCommand As OleDbCommand
- Public Sub New()
- tempDB = New OleDbConnection(GetDatabaseName)
- End Sub
- Public Sub New(ByRef tDB As OleDbConnection, ByVal sDatabasePath As String)
- tDB = New OleDbConnection(sDatabasePath)
- End Sub
- Public Sub CloseConnection()
- If tempDB.State <> ConnectionState.Closed Then
- tempDB.Close()
- tempDB.Dispose()
- End If
-
- End Sub
- Public Sub CloseConnection(ByRef tDb As OleDbConnection)
- If tDb.State <> ConnectionState.Closed Then
- tDb.Close()
- tDb.Dispose()
- End If
- End Sub
- 'Get Database Path/DSN
- Private Function GetDatabaseName() As String
- Return "C:\eReloadAdmin\Database\my_db.mdb"
- End Function
- 'Run query
- Public Function RunQuery(ByVal sSqlString As String) As Boolean
- Try
- Dim iResult As Integer
- oleCommand = New OleDbCommand(sSqlString, tempDB)
- iResult = oleCommand.ExecuteNonQuery()
- oleCommand.Dispose()
- oleCommand = Nothing
- If iResult > 0 Then
- Return True
- Else
- Return False
- End If
- Catch ex As Exception
- Return False
- End Try
- End Function
- Public Function RunQuery(ByVal sSqlString As String, ByRef tDB As OleDbConnection) As Boolean
- Try
- Dim iResult As Integer
- oleCommand = New OleDbCommand(sSqlString, tDB)
- iResult = oleCommand.ExecuteNonQuery()
- oleCommand.Dispose()
- oleCommand = Nothing
- If iResult > 0 Then
- Return True
- Else
- Return False
- End If
- Catch ex As Exception
- Return False
- End Try
- End Function
- 'Get Recordset
- Public Function RunRecordset(ByVal sSqlString As String, ByRef DataReader As OleDbDataReader) As Boolean
- Try
- oleCommand = New OleDbCommand(sSqlString, tempDB)
- DataReader = oleCommand.ExecuteReader()
- oleCommand.Dispose()
- oleCommand = Nothing
- Return True
- Catch ex As Exception
- Return False
- End Try
- End Function
- Public Function RunRecordset(ByVal sSqlString As String, ByRef DataReader As OleDbDataReader, ByRef tdb As OleDbConnection) As Boolean
- Try
- oleCommand = New OleDbCommand(sSqlString, tdb)
- DataReader = oleCommand.ExecuteReader()
- oleCommand.Dispose()
- oleCommand = Nothing
- Return True
- Catch ex As Exception
- Return False
- End Try
- End Function
- End Class
Copy the Code |
|
|
|
|
|
|
|
kalau dh ada sikap kebodohan & malas mencari... hulur je $$$ pasti ada yg tolong buatkan
|
|
|
|
|
|
|
|
Balas #4 BorderManager\ catat
Tak dak feel la kalu gitu... hahahahahah..
nih yang dah jalan...
apa pendapat ko.. ok ka?
|
|
|
|
|
|
|
|
sory dah 5 tahun tak buka .NET takleh comment |
|
|
|
|
|
|
|
Balas #6 BorderManager\ catat
heheheheh...
skarang ko develop guna apo? |
|
|
|
|
|
|
|
PHP je....programming for fun only |
|
|
|
|
|
|
|
Balas #8 BorderManager\ catat
ooooo....
aku skarang dok menggodek .net...
php boleh la sesikit... heheheh |
|
|
|
|
|
|
|
Balas #5 i212\ catat
cantik dah nihh.... pas nih function lehh ahh kasi public sharedd ... medium tier nya... br ada businessss logicc baru cenanggg pas nih.... |
|
|
|
|
|
|
| |
|