Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Datagridview Lastrow Values & Its Datatable lastrow problem !!!

Status
Not open for further replies.

Mahey

Programmer
Dec 24, 2008
52
SA
I have a DatagridView with 10-columns and Allow user to add new row is True.
But the problem is when the user entering the data's in new row's from the last row, when they
entered the data in 4th cell, they like to save the data.

But it's not saving, the uncompleted last row.
Iam using the following for save.

-----------------------------------------------------------

Dim DAD31 As SqlDataAdapter,DS31 As New DataSet,DTB31 As New DataTable

Dim Save_4 As String = "insert into itemmst (itm_description) values (&itm_description)"

DAD31.InsertCommand = New SqlCommand(Save_4, con)
con.Open()

Dim Trans As SqlTransaction
Trans = con.BeginTransaction
DAD31.InsertCommand.Transaction = Trans

Try
DAD31.Update(DS31.Tables(0))
Trans.Commit()

Catch ex As Exception
If Not Trans Is Nothing Then
Trans.Rollback()
End If
MsgBox(ex.Message)
End Try

con.Close()
----------------------------------------------------------

THANK YOU
 
Are you getting an errormessage?
What does ?Save_4
look like if you enter it into the immediate window?
i.e. Was does the actual insert statement look like?

If this is SQL Server , have you tried running a Trace (SQLProfiler) on the application to see what it is sending to SQL?

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top