Click here to Skip to main content
16,008,954 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionText box versus Combo box question Pin
vb200716-Apr-07 15:50
vb200716-Apr-07 15:50 
AnswerRe: Text box versus Combo box question Pin
Code_Doctor16-Apr-07 16:06
Code_Doctor16-Apr-07 16:06 
GeneralRe: Text box versus Combo box question Pin
vb200716-Apr-07 18:26
vb200716-Apr-07 18:26 
AnswerRe: Text box versus Combo box question Pin
klaydze17-Apr-07 22:11
klaydze17-Apr-07 22:11 
Questioncreate an xml file from treeview control Pin
diees16-Apr-07 14:01
diees16-Apr-07 14:01 
QuestionMapping to QBasic double precision datatype Pin
G-316-Apr-07 11:24
G-316-Apr-07 11:24 
QuestionDatagrid selection sync with fields. Pin
T-Go16-Apr-07 8:35
T-Go16-Apr-07 8:35 
AnswerRe: Datagrid selection sync with fields. Pin
klaydze17-Apr-07 23:31
klaydze17-Apr-07 23:31 
try this one:

Dim objdataadapter As New SqlDataAdapter
Dim objcommand As New SqlCommand
Dim objdatatable As New DataTable
Dim objdataset As New DataSet
Dim objconn As New SqlConnection
Dim nrow As Integer

Dim strselect As String

Try
strselect = "Select * from table1"
objconn = New SqlConnection("Server=localhost; DataBase=table1; User ID=sa; pwd=")

objdataadapter.SelectCommand = New SqlCommand(strselect, objcon)
objdataadapter.Fill(objdataset)

objdatatable = objdataset.Tables(0)

If objdatatable.Rows.Count > 0 Then
DataGrid1.DataSource = objdatatable
End If

NOTE: this is optional. you can put this code

With objcommand
.Connection = objconn
.Connection.Open()
.CommandText = strselect
.CommandType = CommandType.Text
.Connection.Close()
End With



Catch ex As Exception
MsgBox(ex.ToString)
End Try





Don't block the drive way of all the newbies in programming. Smile | :) )

QuestionWeb Browser- Local Pin
WLugo16-Apr-07 5:15
WLugo16-Apr-07 5:15 
AnswerRe: Web Browser- Local Pin
Dave Kreskowiak17-Apr-07 1:52
mveDave Kreskowiak17-Apr-07 1:52 
QuestionDatagrid Pin
Dayekh16-Apr-07 4:21
Dayekh16-Apr-07 4:21 
AnswerRe: Datagrid Pin
Dave Kreskowiak17-Apr-07 1:51
mveDave Kreskowiak17-Apr-07 1:51 
GeneralRe: Datagrid Pin
Dayekh17-Apr-07 2:06
Dayekh17-Apr-07 2:06 
GeneralRe: Datagrid Pin
Dave Kreskowiak17-Apr-07 3:44
mveDave Kreskowiak17-Apr-07 3:44 
GeneralRe: Datagrid Pin
Dayekh17-Apr-07 3:59
Dayekh17-Apr-07 3:59 
GeneralRe: Datagrid Pin
Dave Kreskowiak17-Apr-07 7:22
mveDave Kreskowiak17-Apr-07 7:22 
GeneralRe: Datagrid Pin
Dayekh17-Apr-07 11:12
Dayekh17-Apr-07 11:12 
QuestionHow to show video from DVR Card? Pin
somchoto16-Apr-07 4:05
somchoto16-Apr-07 4:05 
AnswerRe: How to show video from DVR Card? Pin
Dave Kreskowiak16-Apr-07 4:36
mveDave Kreskowiak16-Apr-07 4:36 
Questionvb dot net doubt Pin
shalinikannan16-Apr-07 2:12
shalinikannan16-Apr-07 2:12 
AnswerRe: vb dot net doubt Pin
kubben16-Apr-07 2:18
kubben16-Apr-07 2:18 
AnswerRe: vb dot net doubt Pin
Dave Kreskowiak16-Apr-07 3:31
mveDave Kreskowiak16-Apr-07 3:31 
QuestionConnection Error Pin
reykentj16-Apr-07 1:57
reykentj16-Apr-07 1:57 
AnswerRe: Connection Error Pin
kubben16-Apr-07 2:21
kubben16-Apr-07 2:21 
GeneralRe: Connection Error Pin
reykentj16-Apr-07 3:26
reykentj16-Apr-07 3:26 

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.