Go Back   Team-BHP > Around the Corner > Shifting gears > Gadgets, Computers & Software


Reply
 
Thread Tools Search this Thread
Old 22nd May 2008, 09:41   #1
Senior - BHPian
 
mjothi's Avatar
 
Join Date: Dec 2007
Location: Bangalore
Posts: 3,252
Thanked: 216 Times
Default Clarification on .NET (VB 2005 Express edition)

I am trying to create a program to insert / update records in MS Access DB. I tried to check the MSDN, forums and somehow getting there. It looks so easy, but tough. I get strange error when I execute the connection.open command :(
The error I get is
"A first chance exception of type 'System.Data.OleDb.OleDbException' occurred in System.Data.dll"
Below is the function.

Public Sub InsertRow(ByVal connectionString As String, _
ByVal insertSQL As String)
Using connection As New OleDbConnection(connectionString)
' The insertSQL string contains a SQL statement that
' inserts a new row in the source table.
Dim command As New OleDbCommand(insertSQL)

' Set the Connection to the new OleDbConnection.
command.Connection = connection

' Open the connection and execute the insert command.
Try
connection.Open()
command.ExecuteNonQuery()
Catch ex As Exception
Console.WriteLine(ex.Message)
End Try
' The connection is automatically closed when the
' code exits the Using block.
End Using
End Sub

Any helps?
mjothi is offline   Reply With Quote
Old 22nd May 2008, 11:14   #2
Senior - BHPian
 
NetfreakBombay's Avatar
 
Join Date: Jan 2008
Location: Bombay
Posts: 1,375
Thanked: 315 Times
Default

What is the value of connection string? Are you using a DSN?
NetfreakBombay is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads
Thread Thread Starter Forum Replies Last Post
Wireless net for Laptop carboy Gadgets, Computers & Software 14 19th October 2007 17:00
advice me AI NET gbpscars In-Car Entertainment 8 30th July 2006 01:05
Which is best way to connect 2 net through cell phone hari_rama Gadgets, Computers & Software 14 24th March 2006 16:16


All times are GMT +5.5. The time now is 12:52.

Copyright 2000 - 2017, Team-BHP.com
Proudly powered by E2E Networks