473,549 Members | 2,670 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

connect VB net and MS Access ODBC: odbcConnection reference error

24 New Member
everything works except for the Dim con As New OdbcConnection( "DSN=yoh;")

why?

thanks!


Expand|Select|Wrap|Line Numbers
  1. imports System.Data.Odbc
  2.  
  3. Public Class Class1
  4.     Dim con As New OdbcConnection("DSN=yoh;")
  5.     Dim cmd As New OdbcCommand
  6.  
  7.     Public neym As String
  8.  
  9.     Public Sub New()
  10.         con.Open()
  11.  
  12.         cmd.Connection = con
  13.         cmd.CommandText = "SELECT * FROM table1"
  14.  
  15.     End Sub
  16.  
  17.     Public Sub creates()
  18.         cmd.CommandText = "INSERT INTO table1(Neyms) VALUES('" + neym + "')"
  19.         cmd.ExecuteNonQuery()
  20.  
  21.     End Sub
Mar 18 '11 #1
1 3267
yarbrough40
320 Contributor
are you sure this "yoh" data source is configured properly?
You may want to try to connect to the access database directly.
Expand|Select|Wrap|Line Numbers
  1. con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Folder1\Folder2\MyAccessDatabase.mdb"
Mar 20 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
6840
by: jj | last post by:
I have one access database on the desktop and another access database on a remote web server. Is there any way to setup an ODBC link between the two? I've tried adding IP addresses and even domain names to the network path and it never finds the connection. Is there another way to connect or some other trick to this? I'd like the...
1
3041
by: ishabir | last post by:
I have quite a few Oracle linked tables into my Access(97) database. But when you want to open a table get a pop window to enter Username, Password and Server. What I am trying to do is put some code on the open event of the startup form that sets this up so that you don't get the popup connect window. I am having problem getting it...
0
1330
by: olliver.mierau | last post by:
Hi, I have a Access 2000 database which store in some tables about 500.000 recordsets. As the performance is not very impressive I created a table in a MySQL database and connected via ODBC. If I try to transfer the data via Access Append-Query an error comes up with something like "not possible to go back > you want to cointinue?". After...
0
5010
by: Lewt | last post by:
I am aware of the 'hack the registry' approach. This is just not a safe way to accomplish this on a user's PC. I need to do this the right way. Is there anyone -perhaps from Microsoft - out there who can assist me on this? "Colin Stutley" wrote: > I now see your dilemma. > > Not sure of the appropiate API calls, but an alternative may...
2
2202
by: Jeff | last post by:
I'm getting an Object Reference error before I even run my app, and I'm not sure where to look to find the cause. I'd appreciate your help. When I open my Windows Application project, the following Microsoft Development Environment error message displays: "Object reference not set to an instance of an object." Then when I access the...
0
1822
by: t0nt0n | last post by:
i have an xp OS service pack 2 currently working on a project that uses ms access 2003 with mysql 5.0 backend... i get an odbc--call failed error when I manually changed the system date in my computer.... I need to do this to test if my code works alright but instead the error occurs..... sometimes the error will not occur but often times...
16
9160
by: network-admin | last post by:
We have Problems with Access query on Oracle 10g Database with ODBC Connection. The Query_1 is such as select * from xtable where ycolumn <"S" Result = ODBC Faild ----------------------------------------------------
6
14798
seligerasmus
by: seligerasmus | last post by:
Greetings, I'm having a bit of trouble with a small web service I've been writing, specifically with the connectivity aspect of the service. My scenario is as follows : I'm using the IBM iSeries Access ODBC driver to connect to an iSeries (i5/OS, V5R4) midrange box. I've used this driver and a similar DSN in the past with no problems. ...
5
6832
by: kchang | last post by:
I am trying to view my reports based on a linked table database. However both the reports and the queries they're based on give me a "odbc--call failed" error. When I click on help it cites error 3146 and suggests that either the data source is on a network drive or that I am not connected to the network. I am not sure what either means but I am...
4
1791
by: Jeff | last post by:
I need to export MySQL data to Access. As always, there seems to be more than one way to do this. I notice that PHP has: DB.php If I was doing this in perl, there would be an ODBC driver (DBD::ODBC). Is there such a thing in PHP? Can this play well with DBO? I see some commercial driver products, but my needs are modest as I'm
0
7521
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7720
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7473
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7810
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5088
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3501
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1944
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1061
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
764
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.