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!

Code for Update button

Status
Not open for further replies.

mxo

Programmer
May 20, 2005
51
ZA
Hi all

I have a table with records from access database but it won't allow me to edit records, Please see the InvalidOperation: Update requires a valid UpdateCommand when passed DataRow collection with modified rows.

Please assist
 
So how did you make the dataset?

Christiaan Baes
Belgium

My Blog
"In a system where you can define a factor as part of a third factor, you need another layer to check the main layer in case the second layer is not the base unit." - jrbarnett
 
Hi All

A while ago i wrote a code the that uses SQL qeury and display the results into a grid now I would like to export results from the grid to excel in vb.net/vb.net2005

see the code below:
Imports System
Imports System.Data
Imports System.Data.OleDb

Public Class frmMain
Inherits System.Windows.Forms.Form

Private Const MAX_RECORDS As Integer = 10000
Private strConnect As String

Private Function GetFileName() As String
Dim NewFileName As String
Dim Newfile As OpenFileDialog = New OpenFileDialog()
Dim MyChoice As DialogResult

With Newfile
.Filter = "Access Files (*.mdb)|*.mdb|All Files (*.*)|*.*"
.FilterIndex = 1
.DefaultExt = "mdb"
.InitialDirectory = "C:\Documents and Settings\User\My Documents\Line.mdb"
.CheckFileExists = False
.ReadOnlyChecked = True
.Title = "Open Access Data File"
End With

MyChoice = Newfile.ShowDialog
If MyChoice = DialogResult.Cancel Then
NewFileName = ""
Else
NewFileName = Newfile.FileName
End If
If NewFileName.Length > 0 Then
Return NewFileName
End If
End Function

Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim FileName As String
Dim AdoConn As New ADODB.Connection()
Dim MyCat As New ADOX.Catalog()
Dim tbl As ADOX.Table

FileName = GetFileName()
If FileName.Length = 0 Then
Exit Sub
End If
Me.Text = "SQL LineSystem: " & FileName
strConnect = "Provider=Microsoft.JetOLEDB.4.0;Password="""";UserID=Admin;Data Source="
strConnect &= FileName
AdoConn.Open(strConnect)
MyCat.ActiveConnection = AdoConn

For Each tbl In MyCat.Tables
lstTables.Items.Add(tbl.Name.ToString)
Next
AdoConn.Close()

End Sub

Please assist
Mxo
South Africa

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top