۰۲-خرداد-۱۳۸۸, ۱۰:۱۳:۳۵
سلام
برنامه ی که می شه به کمک vb جدول تو aceess ایجاد کرد فقط انگار با adodc کار میکنه ولی من میخوام با data ,DBGride کار کنه
Dim ADOXcatalog As New Catalog
Dim ADOXtable As New Table
Dim ADOXindex As New ADOX.Index
Dim Filde As New Column
Public sa As String
Private Sub cmddd_Click()
Dim DBAddress, DBTable As String
DBAddress = "\Ne.mdb"
DBTable = Text2.Text
Data1.RecordsetType = cmd
s = App.Path & "\Ne.mdb"
Data1.c
Data1.RecordSource = "SELECT * FROM [" & DBTable & "]"
Data1.Refresh
End Sub
Private Sub Command1_Click()
On Error GoTo errhandler
If Text2.Text = "" Or Text1.Text = "" Then
MsgBox "Please select a Database and enter a Table name", vbCritical, "Error"
Exit Sub
End If
ADOXcatalog.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & Text1.Text
ADOXtable.Name = Text2.Text
ADOXtable.Columns.Append "Column1"
ADOXtable.Columns.Append "Column2"
ADOXtable.Columns.Append "Column3"
ADOXcatalog.Tables.Append ADOXtable
MsgBox "Opration Comlited", vbInformation, "Create Table"
errhandler:
If Err.Number = -2147217897 Then
MsgBox "Database already exists", vbCritical, "Error"
ElseIf Err.Number <> 0 Then
MsgBox Err.Description & vbCrLf & "Operation not complete", vbCritical, "Error"
End If
Set ADOXtable = Nothing
Set ADOXindex = Nothing
Set ADOXcatalog = Nothing
End Sub
Private Sub Command2_Click()
CommonDialog1.Flags = cdlOFNFileMustExist
CommonDialog1.ShowOpen
Text1.Text = CommonDialog1.FileName
End Sub
اینم کد برنامست
اگه میشه راهنمایی کنید
برنامه ی که می شه به کمک vb جدول تو aceess ایجاد کرد فقط انگار با adodc کار میکنه ولی من میخوام با data ,DBGride کار کنه
Dim ADOXcatalog As New Catalog
Dim ADOXtable As New Table
Dim ADOXindex As New ADOX.Index
Dim Filde As New Column
Public sa As String
Private Sub cmddd_Click()
Dim DBAddress, DBTable As String
DBAddress = "\Ne.mdb"
DBTable = Text2.Text
Data1.RecordsetType = cmd
s = App.Path & "\Ne.mdb"
Data1.c
Data1.RecordSource = "SELECT * FROM [" & DBTable & "]"
Data1.Refresh
End Sub
Private Sub Command1_Click()
On Error GoTo errhandler
If Text2.Text = "" Or Text1.Text = "" Then
MsgBox "Please select a Database and enter a Table name", vbCritical, "Error"
Exit Sub
End If
ADOXcatalog.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & Text1.Text
ADOXtable.Name = Text2.Text
ADOXtable.Columns.Append "Column1"
ADOXtable.Columns.Append "Column2"
ADOXtable.Columns.Append "Column3"
ADOXcatalog.Tables.Append ADOXtable
MsgBox "Opration Comlited", vbInformation, "Create Table"
errhandler:
If Err.Number = -2147217897 Then
MsgBox "Database already exists", vbCritical, "Error"
ElseIf Err.Number <> 0 Then
MsgBox Err.Description & vbCrLf & "Operation not complete", vbCritical, "Error"
End If
Set ADOXtable = Nothing
Set ADOXindex = Nothing
Set ADOXcatalog = Nothing
End Sub
Private Sub Command2_Click()
CommonDialog1.Flags = cdlOFNFileMustExist
CommonDialog1.ShowOpen
Text1.Text = CommonDialog1.FileName
End Sub
اینم کد برنامست
اگه میشه راهنمایی کنید