Click here to Skip to main content
15,889,808 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: what values should I use for my datatable? Pin
rajulama16-Apr-09 21:30
rajulama16-Apr-09 21:30 
GeneralRe: what values should I use for my datatable? Pin
Johan Hakkesteegt16-Apr-09 21:57
Johan Hakkesteegt16-Apr-09 21:57 
GeneralRe: what values should I use for my datatable? Pin
rajulama16-Apr-09 22:13
rajulama16-Apr-09 22:13 
GeneralRe: what values should I use for my datatable? Pin
Johan Hakkesteegt16-Apr-09 22:17
Johan Hakkesteegt16-Apr-09 22:17 
GeneralRe: what values should I use for my datatable? Pin
rajulama16-Apr-09 22:33
rajulama16-Apr-09 22:33 
GeneralRe: what values should I use for my datatable? Pin
Johan Hakkesteegt16-Apr-09 22:44
Johan Hakkesteegt16-Apr-09 22:44 
GeneralRe: what values should I use for my datatable? Pin
rajulama16-Apr-09 22:57
rajulama16-Apr-09 22:57 
GeneralRe: what values should I use for my datatable? Pin
Johan Hakkesteegt16-Apr-09 23:18
Johan Hakkesteegt16-Apr-09 23:18 
That is because the datagridview offers an empty line at the bottom for the user to enter new rows.

You can prevent this row from being entered into your database by checking if all cells are empty or not.

So instead of putting dgr1.Cells(0).Value directly into the insert statement, you could do something like this:
If Not dgr1.Cells(0).Value & dgr1.Cells(1).Value & dgr1.Cells(2).Value & etc. = "" Then
Dim cmd As OleDbCommand = New OleDbCommand("INSERT INTO Sheet1(Field1, Field2, Field3, Field4, Field5, Field6, Field7) Values('" & dgr1.Cells(0).Value & "', '" & dgr1.Cells(1).Value & "', '" & dgr1.Cells(2).Value & "', '" & dgr1.Cells(3).Value & "', '" & dgr1.Cells(4).Value & "', '" & dgr1.Cells(5).Value & "', '" & dgr1.Cells(6).Value & "')", con)
End If


My advice is free, and you may get what you paid for.

GeneralRe: what values should I use for my datatable? Pin
rajulama16-Apr-09 23:30
rajulama16-Apr-09 23:30 
GeneralRe: what values should I use for my datatable? Pin
rajulama16-Apr-09 23:43
rajulama16-Apr-09 23:43 
GeneralRe: what values should I use for my datatable? Pin
Jay Royall17-Apr-09 0:46
Jay Royall17-Apr-09 0:46 
GeneralRe: what values should I use for my datatable? Pin
Johan Hakkesteegt17-Apr-09 0:51
Johan Hakkesteegt17-Apr-09 0:51 
QuestionHow to copy some files from one folder to other with multithreading in VB.NET? Pin
Hadi Basiri16-Apr-09 14:04
Hadi Basiri16-Apr-09 14:04 
AnswerRe: How to copy some files from one folder to other with multithreading in VB.NET? Pin
Christian Graus16-Apr-09 15:13
protectorChristian Graus16-Apr-09 15:13 
GeneralRe: How to copy some files from one folder to other with multithreading in VB.NET? Pin
CPallini16-Apr-09 21:56
mveCPallini16-Apr-09 21:56 
AnswerRe: How to copy some files from one folder to other with multithreading in VB.NET? Pin
Zaegra16-Apr-09 20:33
Zaegra16-Apr-09 20:33 
Questionload xml into text box Pin
kryan016-Apr-09 13:17
kryan016-Apr-09 13:17 
AnswerRe: load xml into text box Pin
kryan016-Apr-09 13:18
kryan016-Apr-09 13:18 
GeneralRe: load xml into text box Pin
kryan016-Apr-09 13:18
kryan016-Apr-09 13:18 
AnswerRe: load xml into text box Pin
Zaegra16-Apr-09 20:26
Zaegra16-Apr-09 20:26 
QuestionRe: load xml into text box [modified] Pin
kryan017-Apr-09 4:25
kryan017-Apr-09 4:25 
AnswerRe: load xml into text box Pin
Christian Graus16-Apr-09 15:11
protectorChristian Graus16-Apr-09 15:11 
GeneralRe: load xml into text box Pin
kryan017-Apr-09 1:25
kryan017-Apr-09 1:25 
QuestionHelp Pin
mo1om116-Apr-09 11:38
mo1om116-Apr-09 11:38 
AnswerRe: Help Pin
Luc Pattyn16-Apr-09 11:51
sitebuilderLuc Pattyn16-Apr-09 11:51 

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.