Click here to Skip to main content
15,896,426 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: about retriving Ms-acess table Pin
Rupesh Kumar Swami3-Apr-08 21:17
Rupesh Kumar Swami3-Apr-08 21:17 
GeneralAutomate excel help Pin
Member 44350513-Apr-08 19:12
Member 44350513-Apr-08 19:12 
GeneralRe: Automate excel help Pin
Dave Kreskowiak4-Apr-08 4:32
mveDave Kreskowiak4-Apr-08 4:32 
GeneralRe: Automate excel help Pin
Member 44350514-Apr-08 9:39
Member 44350514-Apr-08 9:39 
GeneralRe: Automate excel help Pin
Member 44350514-Apr-08 11:29
Member 44350514-Apr-08 11:29 
GeneralEnable read only column as editable when it is a new row Pin
Member 39363563-Apr-08 19:01
Member 39363563-Apr-08 19:01 
GeneralRe: Enable read only column as editable when it is a new row Pin
Dave Kreskowiak4-Apr-08 4:26
mveDave Kreskowiak4-Apr-08 4:26 
QuestionImport Excel sheet into access database using vb.net Pin
Member 39363563-Apr-08 18:51
Member 39363563-Apr-08 18:51 
Hello Friends,

I am newbie when it comes to vb.net and i need to import excel sheet into access db using vb.net application. Here is the code i use for now to upload excel sheet and it works perfectly but i when i upload the file again it should include only the new records by checking the existence of ID field which i use as primary key. For now it pops up the message"Table Exists already".Could anyone help me pls?


Dim AccessConnection As New System.Data.OleDb.OleDbConnection

Dim _conn As String

Dim SchemaTable As DataTable

AccessConnection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=somefile.mdb"

AccessConnection.Open()

SchemaTable = AccessConnection.GetOleDbSchemaTable(System.Data.OleDb.OleDbSchemaGuid.Columns, New Object() {Nothing, Nothing, "mytable"})



If SchemaTable.Rows.Count <> 0 Then

MsgBox("Table Exists already" )

Else

Dim _filename As String = "myexcelsheet.xls"

_conn = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & _filename & ";" & "Extended Properties=Excel 8.0;"

Dim _connection As OleDbConnection = New OleDbConnection(_conn)

Dim _command As OleDbCommand = New OleDbCommand

_command.Connection = _connection

Try

_command.CommandText = "SELECT * INTO [MS Access;Database=somefile.mdb].[accesstbname] FROM [Sheet1$]"

_connection.Open()

_command.ExecuteNonQuery()

MessageBox.Show("The Data Imported Successfully!")

Catch e1 As Exception

MessageBox.Show("Error!.Your Excel Spread Sheet has some problems.")

End Try

End If
GeneralRe: Import Excel sheet into access database using vb.net Pin
Dave Kreskowiak4-Apr-08 4:23
mveDave Kreskowiak4-Apr-08 4:23 
GeneralRe: Import Excel sheet into access database using vb.net Pin
Member 39363564-Apr-08 17:04
Member 39363564-Apr-08 17:04 
GeneralPerformance Question Pin
programmervb.netc++3-Apr-08 15:37
programmervb.netc++3-Apr-08 15:37 
GeneralRe: Performance Question Pin
kaddim3-Apr-08 16:21
kaddim3-Apr-08 16:21 
GeneralRe: Performance Question Pin
programmervb.netc++3-Apr-08 19:54
programmervb.netc++3-Apr-08 19:54 
GeneralRe: Performance Question Pin
darkelv3-Apr-08 20:38
darkelv3-Apr-08 20:38 
QuestionAuto select item in listbox when someone types in textbox Pin
Member 19022153-Apr-08 5:50
Member 19022153-Apr-08 5:50 
GeneralRe: Auto select item in listbox when someone types in textbox Pin
jzonthemtn3-Apr-08 14:59
jzonthemtn3-Apr-08 14:59 
GeneralRe: Auto select item in listbox when someone types in textbox Pin
Member 19022155-Apr-08 10:57
Member 19022155-Apr-08 10:57 
GeneralDelete row from Datagirdview Pin
yetrus3-Apr-08 4:52
yetrus3-Apr-08 4:52 
GeneralRe: Delete row from Datagirdview Pin
ilprincipe3-Apr-08 23:13
ilprincipe3-Apr-08 23:13 
GeneralRe: Delete row from Datagirdview Pin
MBCDC5-Apr-08 0:21
MBCDC5-Apr-08 0:21 
QuestionHow to prevent multiple user login using one account in VB Pin
kingascona3-Apr-08 4:45
professionalkingascona3-Apr-08 4:45 
GeneralRe: How to prevent multiple user login using one account in VB Pin
Dave Kreskowiak3-Apr-08 5:30
mveDave Kreskowiak3-Apr-08 5:30 
QuestionCan we search column in MS access (or in Excel) table with the header which contains spaces? [modified] Pin
ATC3-Apr-08 4:07
ATC3-Apr-08 4:07 
AnswerRe: Can we search column in MS access (or in Excel) table with the header which contains spaces? Pin
Dave Kreskowiak3-Apr-08 5:25
mveDave Kreskowiak3-Apr-08 5:25 
GeneralRe: Can we search column in MS access (or in Excel) table with the header which contains spaces? Pin
ATC3-Apr-08 8:14
ATC3-Apr-08 8:14 

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.