Click here to Skip to main content
16,010,392 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: simple question Pin
Nick Parker27-Sep-02 9:12
protectorNick Parker27-Sep-02 9:12 
GeneralRe: simple question Pin
Paul Riley27-Sep-02 10:34
Paul Riley27-Sep-02 10:34 
GeneralRe: simple question Pin
Nick Parker28-Sep-02 17:39
protectorNick Parker28-Sep-02 17:39 
Questionhow to implement progress bar for any process or procedure ? Pin
drmzunlimited26-Sep-02 21:29
drmzunlimited26-Sep-02 21:29 
GeneralFindFirstFile Pin
Anonymous26-Sep-02 21:00
Anonymous26-Sep-02 21:00 
GeneralRe: FindFirstFile Pin
BhaskarG10-Oct-02 19:31
BhaskarG10-Oct-02 19:31 
Questionhow to get results from a select query and view them in VB.net in a form?? Pin
drmzunlimited26-Sep-02 8:25
drmzunlimited26-Sep-02 8:25 
AnswerRe: how to get results from a select query and view them in VB.net in a form?? Pin
Peet Schultz26-Sep-02 19:46
Peet Schultz26-Sep-02 19:46 
In this example I am using the datadapter, as you can bind the whole resultset to the grid in one command, with the datareader you have to loop through the resultset.



Dim oConnection As SqlClient.SqlConnection = New SqlClient.SqlConnection()
Dim oCommand As SqlClient.SqlCommand = New SqlClient.SqlCommand()
Dim oDataTableResources As Data.DataTable = New Data.DataTable()
Dim oDataTableSites As Data.DataTable = New Data.DataTable()
Dim oDataAdapter As SqlClient.SqlDataAdapter = New SqlClient.SqlDataAdapter()

Dim sSiteName As String
Dim sResourceName As String
Const iDayLength As Integer = 86400

sSQL = "Select * from Category"

gsConnectString = " Initial Catalog=" & UCase(Trim(Me.txtDB.Text)) & _
";Data Source=" & UCase(Trim(Me.txtSVR.Text)) & _
";User ID=" & UCase(Trim(Me.txtUID.Text)) & _
";Password=" & Trim(Me.txtPWD.Text) & ";"

oConnection.ConnectionString = gsConnectString

Try
oConnection.Open()

Catch o As System.Exception

MsgBox(o.Message, MsgBoxStyle.Critical, gsMessageBoxHeader)
Me.Cursor = Cursors.Default
Exit Sub
End Try

Try
oCommand.Connection = oConnection
oCommand.CommandText = sSQL
oDataAdapter.SelectCommand = oCommand
'fill the data adapter
oDataAdapter.Fill(oDataTableResources)
'bind to the datagrid
dbgrdDataGrid.DataSource = oDataTableResources
dbgrdDataGrid.ParentRowsVisible = False


Catch o As System.Exception

MsgBox(o.Message)
Me.Cursor = Cursors.Default
End Try


I do not have any code of getting a specific cell from the grid. I am sure you will be able to find samples on the web.


YASP
General"class does not support automation..." error Pin
ns26-Sep-02 6:16
ns26-Sep-02 6:16 
GeneralRe: "class does not support automation..." error Pin
Nick Parker26-Sep-02 17:38
protectorNick Parker26-Sep-02 17:38 
GeneralRe: "class does not support automation..." error Pin
ns27-Sep-02 0:40
ns27-Sep-02 0:40 
GeneralRe: "class does not support automation..." error Pin
Paul Riley27-Sep-02 1:39
Paul Riley27-Sep-02 1:39 
GeneralRe: "class does not support automation..." error Pin
ns27-Sep-02 1:48
ns27-Sep-02 1:48 
GeneralRe: "class does not support automation..." error Pin
Paul Riley27-Sep-02 2:16
Paul Riley27-Sep-02 2:16 
GeneralRe: "class does not support automation..." error Pin
ns27-Sep-02 2:50
ns27-Sep-02 2:50 
GeneralRe: "class does not support automation..." error Pin
Paul Riley27-Sep-02 3:26
Paul Riley27-Sep-02 3:26 
GeneralRe: "class does not support automation..." error Pin
ns27-Sep-02 3:32
ns27-Sep-02 3:32 
Generalheres where it chokes.... Pin
ns27-Sep-02 3:31
ns27-Sep-02 3:31 
GeneralRe: heres where it chokes.... Pin
Paul Riley27-Sep-02 3:59
Paul Riley27-Sep-02 3:59 
Generalgot it finally Pin
ns27-Sep-02 4:16
ns27-Sep-02 4:16 
GeneralRe: got it finally Pin
Paul Riley27-Sep-02 4:22
Paul Riley27-Sep-02 4:22 
Questionhow to position a form off the screen? Pin
ns26-Sep-02 4:42
ns26-Sep-02 4:42 
AnswerRe: how to position a form off the screen? Pin
Nick Parker27-Sep-02 9:15
protectorNick Parker27-Sep-02 9:15 
GeneralRe: how to position a form off the screen? Pin
ns27-Sep-02 9:40
ns27-Sep-02 9:40 
Questionhandle to child window...how to? Pin
ns26-Sep-02 4:28
ns26-Sep-02 4:28 

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.