Click here to Skip to main content
15,920,217 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: How to import data by character wise from excel to sql server Pin
Dave Kreskowiak26-Dec-07 3:44
mveDave Kreskowiak26-Dec-07 3:44 
AnswerRe: How to import data by character wise from excel to sql server Pin
Paul Conrad30-Dec-07 10:47
professionalPaul Conrad30-Dec-07 10:47 
GeneralDataGridView: Add combobox Pin
nishkarsh_k25-Dec-07 23:05
nishkarsh_k25-Dec-07 23:05 
GeneralRe: DataGridView: Add combobox Pin
helelark12326-Dec-07 5:01
helelark12326-Dec-07 5:01 
GeneralRe: DataGridView: Add combobox Pin
nishkarsh_k26-Dec-07 17:33
nishkarsh_k26-Dec-07 17:33 
GeneralRe: DataGridView: Add combobox Pin
helelark12326-Dec-07 18:54
helelark12326-Dec-07 18:54 
GeneralRe: DataGridView: Add combobox Pin
nishkarsh_k26-Dec-07 23:19
nishkarsh_k26-Dec-07 23:19 
QuestionHow to save data from datatable to database using vb.net Pin
Eunice (VB junior)25-Dec-07 21:15
Eunice (VB junior)25-Dec-07 21:15 
Hi Everyone,
I'm working on window application. I'm adding a set of new rows to datagrid using a datatable.
Once completed, i want to save all the added rows from datagrid to database.
How should i save it into database??
Can anyone advice me? Thanks in advanced.

Here is the codes:-
public Sub DataGrid()

myTable = New DataTable("Exam")
Dim Employee As DataColumn = New DataColumn("Employee")
Employee.DataType = System.Type.GetType("System.String")
myTable.Columns.Add(Employee)

Dim Score As DataColumn = New DataColumn("Score")
Score.DataType = System.Type.GetType("System.String")
myTable.Columns.Add(Score)

Dim ds As New DataSet
ds = New DataSet
ds.Tables.Add(myTable)
datagrid1.SetDataBinding(ds, "Exam")

end sub


Private Sub btnComplete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnComplete.Click
Dim strQuery1 As String

strQuery1 = "Insert into MMExam (Employee,Score) values('" & DataTable.Rows(Employee) & "','" & DataTable.Rows(Score )& "')"
myConnection.Open()
myCommand = New SqlCommand(strQuery1, myConnection)

Try
ra = myCommand.ExecuteNonQuery()
myConnection.Close()
Me.Close()

Catch ex As Exception
myConnection.Close()
MessageBox.Show(ex.Message)

End Try
End Sub

thanks,
eunice
AnswerRe: How to save data from datatable to database using vb.net Pin
Dave Kreskowiak26-Dec-07 8:28
mveDave Kreskowiak26-Dec-07 8:28 
Generalparallel port in VB .Net 2008 Pin
meki_211825-Dec-07 20:19
meki_211825-Dec-07 20:19 
GeneralRe: parallel port in VB .Net 2008 Pin
Dave Kreskowiak26-Dec-07 3:40
mveDave Kreskowiak26-Dec-07 3:40 
Questionhow to collect ip address of the systems in LAN Pin
Prakash_Mishra25-Dec-07 20:00
Prakash_Mishra25-Dec-07 20:00 
AnswerRe: how to collect ip address of the systems in LAN Pin
Dave Kreskowiak26-Dec-07 3:36
mveDave Kreskowiak26-Dec-07 3:36 
QuestionProgressBar (Vista) How do I: Split a PB to a few internal colors with different colors, and merging a Percentage indicator label within it? Pin
Shimmy Weitzhandler25-Dec-07 17:00
Shimmy Weitzhandler25-Dec-07 17:00 
GeneralRe: ProgressBar (Vista) How do I: Split a PB to a few internal colors with different colors, and merging a Percentage indicator label within it? Pin
Dave Kreskowiak26-Dec-07 2:10
mveDave Kreskowiak26-Dec-07 2:10 
GeneralRe: ProgressBar (Vista) How do I: Split a PB to a few internal colors with different colors, and merging a Percentage indicator label within it? Pin
Shimmy Weitzhandler26-Dec-07 14:56
Shimmy Weitzhandler26-Dec-07 14:56 
GeneralRe: ProgressBar (Vista) How do I: Split a PB to a few internal colors with different colors, and merging a Percentage indicator label within it? Pin
Dave Kreskowiak27-Dec-07 5:04
mveDave Kreskowiak27-Dec-07 5:04 
GeneralRe: ProgressBar (Vista) How do I: Split a PB to a few internal colors with different colors, and merging a Percentage indicator label within it? Pin
Shimmy Weitzhandler30-Dec-07 8:57
Shimmy Weitzhandler30-Dec-07 8:57 
QuestionCan a Label.BackColor be transparent? Pin
Shimmy Weitzhandler25-Dec-07 16:48
Shimmy Weitzhandler25-Dec-07 16:48 
GeneralRe: Can a Label.BackColor be transparent? Pin
Nilesh Hapse25-Dec-07 18:49
Nilesh Hapse25-Dec-07 18:49 
GeneralRe: Can a Label.BackColor be transparent? Pin
Shimmy Weitzhandler26-Dec-07 15:01
Shimmy Weitzhandler26-Dec-07 15:01 
GeneralLineInput LineFeed problem Pin
MohammadAmiry24-Dec-07 21:23
MohammadAmiry24-Dec-07 21:23 
GeneralRe: LineInput LineFeed problem Pin
Dave Kreskowiak26-Dec-07 6:14
mveDave Kreskowiak26-Dec-07 6:14 
Generalarrary of button Pin
break_day24-Dec-07 4:06
break_day24-Dec-07 4:06 
GeneralRe: arrary of button Pin
darkelv24-Dec-07 4:34
darkelv24-Dec-07 4:34 

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.