Click here to Skip to main content
15,898,134 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Specific version property when adding references Pin
Jon_Boy23-Sep-10 2:05
Jon_Boy23-Sep-10 2:05 
QuestionDetecting disconnection from database Pin
chrispowell1234522-Sep-10 0:56
chrispowell1234522-Sep-10 0:56 
AnswerRe: Detecting disconnection from database Pin
Simon_Whale22-Sep-10 1:09
Simon_Whale22-Sep-10 1:09 
GeneralRe: Detecting disconnection from database Pin
chrispowell1234522-Sep-10 1:44
chrispowell1234522-Sep-10 1:44 
GeneralRe: Detecting disconnection from database Pin
Dave Kreskowiak22-Sep-10 2:04
mveDave Kreskowiak22-Sep-10 2:04 
AnswerRe: Detecting disconnection from database Pin
David Mujica22-Sep-10 3:26
David Mujica22-Sep-10 3:26 
GeneralRe: Detecting disconnection from database Pin
chrispowell1234522-Sep-10 3:55
chrispowell1234522-Sep-10 3:55 
GeneralRe: Detecting disconnection from database Pin
chrispowell1234522-Sep-10 5:37
chrispowell1234522-Sep-10 5:37 
ok, so let me ask if I'm getting this right! I've added a class to act as the DAL:

Public Class data

    Public Function opendatabase(ByVal solid As Odbc.OdbcConnection, ByVal dsn As String)
        Try
            solid.ConnectionString = "dsn=" & dsn & ";uid=xxxx;pwd=xxxx"
            solid.Open()
            desktop.connectionstring = "dsn=" & dsn & ";uid=xxxx;pwd=xxxx"
            Return True
        Catch ex As Exception
            Return False
        End Try
    End Function

    Public Function readdata(ByVal solid As Odbc.OdbcConnection, ByVal sqlquery As String, ByRef datareader As Odbc.OdbcDataReader)
        Try
            Dim command As New Odbc.OdbcCommand(sqlquery, solid)
            datareader = command.ExecuteReader
            Return True
        Catch ex As Exception
            Return False
        End Try
        datareader.Close()
    End Function


    Public Function storedata(ByVal solid As Odbc.OdbcConnection, ByVal sqlcommand As String)
        Try
            Dim command = New Odbc.OdbcCommand(sqlcommand, solid)
            command.ExecuteNonQuery()
            Return True
        Catch ex As Exception
            Return False
        End Try
    End Function
End Class


So whenever I need to read/write/open the database I call these functions. I now just need to put the error messages asking them whether they want to try to re-connect etc where these three functions are returning false.

I'm guessing adding a business logic layer would be to process these results (from the data reader anyway) in a seperate class to the UI and passing it only the detail it needs to affect the UI?

btw this helped explain the tiers quite well.

Chris
GeneralRe: Detecting disconnection from database Pin
David Mujica22-Sep-10 8:35
David Mujica22-Sep-10 8:35 
AnswerRe: Detecting disconnection from database Pin
Tom Deketelaere22-Sep-10 3:57
professionalTom Deketelaere22-Sep-10 3:57 
QuestionRe: Detecting disconnection from database Pin
Eddy Vluggen22-Sep-10 9:17
professionalEddy Vluggen22-Sep-10 9:17 
AnswerRe: Detecting disconnection from database Pin
chrispowell1234523-Sep-10 0:02
chrispowell1234523-Sep-10 0:02 
GeneralRe: Detecting disconnection from database Pin
Dave Kreskowiak23-Sep-10 2:01
mveDave Kreskowiak23-Sep-10 2:01 
GeneralRe: Detecting disconnection from database Pin
chrispowell1234523-Sep-10 2:35
chrispowell1234523-Sep-10 2:35 
GeneralRe: Detecting disconnection from database Pin
Ian Shlasko23-Sep-10 2:58
Ian Shlasko23-Sep-10 2:58 
GeneralRe: Detecting disconnection from database [modified] Pin
Dave Kreskowiak23-Sep-10 5:28
mveDave Kreskowiak23-Sep-10 5:28 
QuestionVBScript - Gathering WMI & Registry information from networked computers - SOLVED [modified] Pin
eeffoc4221-Sep-10 4:30
eeffoc4221-Sep-10 4:30 
AnswerRe: VBScript - Gathering WMI & Registry information from networked computers Pin
Dave Kreskowiak21-Sep-10 6:32
mveDave Kreskowiak21-Sep-10 6:32 
AnswerRe: VBScript - Gathering WMI & Registry information from networked computers Pin
Eddy Vluggen22-Sep-10 9:21
professionalEddy Vluggen22-Sep-10 9:21 
QuestionRe: VBScript - Gathering WMI & Registry information from networked computers - SOLVED Pin
Member 330175419-Jan-11 6:57
Member 330175419-Jan-11 6:57 
Questionbroadcasting data using UDP winsocket control... [modified] Pin
jainiraj20-Sep-10 2:28
jainiraj20-Sep-10 2:28 
AnswerRe: broadcasting data using UDP winsocket control... Pin
DaveAuld20-Sep-10 11:00
professionalDaveAuld20-Sep-10 11:00 
GeneralRe: broadcasting data using UDP winsocket control... Pin
jainiraj20-Sep-10 18:50
jainiraj20-Sep-10 18:50 
GeneralRe: broadcasting data using UDP winsocket control... Pin
DaveAuld20-Sep-10 21:50
professionalDaveAuld20-Sep-10 21:50 
GeneralRe: broadcasting data using UDP winsocket control... Pin
jainiraj21-Sep-10 3:06
jainiraj21-Sep-10 3:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.