Click here to Skip to main content
15,909,896 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Nibbles Pin
supercat914-Nov-07 9:40
supercat914-Nov-07 9:40 
GeneralRe: Nibbles Pin
Dave Kreskowiak14-Nov-07 12:57
mveDave Kreskowiak14-Nov-07 12:57 
GeneralRe: Nibbles Pin
nlarson1114-Nov-07 7:40
nlarson1114-Nov-07 7:40 
GeneralRe: Nibbles Pin
Dave Kreskowiak14-Nov-07 8:22
mveDave Kreskowiak14-Nov-07 8:22 
GeneralRe: Nibbles Pin
nlarson1114-Nov-07 8:26
nlarson1114-Nov-07 8:26 
Questionform closing error Pin
Tom Deketelaere14-Nov-07 4:07
professionalTom Deketelaere14-Nov-07 4:07 
AnswerRe: form closing error Pin
Dave Kreskowiak14-Nov-07 6:24
mveDave Kreskowiak14-Nov-07 6:24 
Questionconnection to SQL server stays open Pin
Tom Deketelaere14-Nov-07 3:32
professionalTom Deketelaere14-Nov-07 3:32 
I'm developing a programme where the user needs to login.
How it should work:
the programme starts and makes a connection to the db (with a standard user and pass) reads the table users and puts that table into a datatable.
once the user has provided his login and pass (and they exist) a new connection to the db is made with the his login and pass (they are created in SQL server), after this only the users connection is used to access the db (that way we can always know who is connected)

this all works and the programme works fine but when I check the connections to the db (in SQL server) it says that there are still 2 connections (per user). Now I don't like this Sigh | :sigh: since this programme is going to be used by 10+ users that would mean there are already 20+ connections (I know that that is now problem for SQL but it just isn't how it is supposed to work) and there are also many other db's hosted onto the server so the less connections the better.

following is the code that I use to get the users from the db:
Public Shared Function ExecSqlInDatatable(ByVal Sql As String, ByVal connstring As String) As DataTable
    Dim dt As New DataTable

    Try
        Dim da As New SqlDataAdapter(Sql, connstring)
        da.Fill(dt)
        'da.Dispose()
        'da = Nothing
        Return dt
    Catch ex As Exception
        MessageBox.Show(ex.Message)
    End Try

    Return dt
End Function

this code works but the connection to the db is maintained.
Any idea why??
Adding the da.dispose and da = nothing didn't help (that's why they are in comment)

any help/idea would be appriciated



If my help was helpfull let me know, if not let me know why.

The only way we learn is by making mistakes.

AnswerRe: connection to SQL server stays open Pin
Colin Angus Mackay14-Nov-07 5:56
Colin Angus Mackay14-Nov-07 5:56 
QuestionBarcode Pin
Naderrafiee14-Nov-07 1:48
Naderrafiee14-Nov-07 1:48 
AnswerRe: Barcode Pin
Boroumandan14-Nov-07 2:08
Boroumandan14-Nov-07 2:08 
AnswerRe: Barcode Pin
Dave Kreskowiak14-Nov-07 5:52
mveDave Kreskowiak14-Nov-07 5:52 
GeneralRe: Barcode Pin
Enriad14-Nov-07 19:48
Enriad14-Nov-07 19:48 
GeneralRe: Barcode Pin
Dave Kreskowiak15-Nov-07 1:21
mveDave Kreskowiak15-Nov-07 1:21 
Questionclose button on Message Box Pin
Abbhie14-Nov-07 1:41
Abbhie14-Nov-07 1:41 
AnswerRe: close button on Message Box Pin
Abbhie14-Nov-07 2:12
Abbhie14-Nov-07 2:12 
QuestionGet Full Network Path Pin
georgegarvasis14-Nov-07 1:28
georgegarvasis14-Nov-07 1:28 
AnswerRe: Get Full Network Path Pin
Boroumandan14-Nov-07 2:05
Boroumandan14-Nov-07 2:05 
AnswerRe: Get Full Network Path Pin
Dave Kreskowiak14-Nov-07 5:51
mveDave Kreskowiak14-Nov-07 5:51 
Questioncomponent one flex grid issue Pin
Tauseef A14-Nov-07 1:06
Tauseef A14-Nov-07 1:06 
AnswerRe: component one flex grid issue Pin
Boroumandan14-Nov-07 2:14
Boroumandan14-Nov-07 2:14 
QuestionRe: component one flex grid issue Pin
Tauseef A14-Nov-07 16:46
Tauseef A14-Nov-07 16:46 
Questionwindows based print on dot matrix printer Pin
nilam1114-Nov-07 0:34
nilam1114-Nov-07 0:34 
AnswerRe: windows based print on dot matrix printer Pin
Duncan Edwards Jones14-Nov-07 1:09
professionalDuncan Edwards Jones14-Nov-07 1:09 
GeneralRe: windows based print on dot matrix printer Pin
nilam1114-Nov-07 1:21
nilam1114-Nov-07 1:21 

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.