473,394 Members | 1,843 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Help With OleDbDataAdapter

hi all(i tried yesterday but it didnt work).
i wrote this code and i get an error msg:
Private Pr_MyCon As System.Data.OleDb.OleDbConnection
Private Pr_DataSet As DataSet
Private Pr_DataAdapter As
System.Data.OleDb.OleDbDataAdapter
Pr_MyCon = New System.Data.OleDb.OleDbConnection
Pr_DataSet = New DataSet("Temp")
Pr_MyCon.ConnectionString = "..."
Pr_DataAdapter = New OleDb.OleDbDataAdapter("select *
from MyTable", Pr_MyCon)
Pr_DataAdapter.Fill(Pr_DataSet, "MyTable")
the error msg saing:"An unhandled exception of
type 'System.Data.OleDb.OleDbException' occurred in
system.data.dll"
Nov 21 '05 #1
4 3945
Hello

You could try this, only you will need to change Connection string and Table
name

Dim Pr_MyCon As System.Data.OleDb.OleDbConnection
Dim Pr_DataSet As DataSet
Dim Pr_DataAdapter As System.Data.OleDb.OleDbDataAdapter
Pr_MyCon = New System.Data.OleDb.OleDbConnection
Pr_DataSet = New DataSet("Temp")
Pr_MyCon.ConnectionString = "Provider=SQLOLEDB.1;Integrated
Security=SSPI;Persist Security Info=False;User ID=ppr;Initial
Catalog=BMS;Data Source=SERVER1"
Pr_DataAdapter = New OleDb.OleDbDataAdapter("select * from CUSTOMER",
Pr_MyCon)
Pr_DataAdapter.Fill(Pr_DataSet, "MyTable")

Regards

Partha

"shachar" <an*******@discussions.microsoft.com> wrote in message
news:28****************************@phx.gbl...
hi all(i tried yesterday but it didnt work).
i wrote this code and i get an error msg:
Private Pr_MyCon As System.Data.OleDb.OleDbConnection
Private Pr_DataSet As DataSet
Private Pr_DataAdapter As
System.Data.OleDb.OleDbDataAdapter
Pr_MyCon = New System.Data.OleDb.OleDbConnection
Pr_DataSet = New DataSet("Temp")
Pr_MyCon.ConnectionString = "..."
Pr_DataAdapter = New OleDb.OleDbDataAdapter("select *
from MyTable", Pr_MyCon)
Pr_DataAdapter.Fill(Pr_DataSet, "MyTable")
the error msg saing:"An unhandled exception of
type 'System.Data.OleDb.OleDbException' occurred in
system.data.dll"

Nov 21 '05 #2
NO, i copied your code and i get the same error msg.
-----Original Message-----
Hello

You could try this, only you will need to change Connection string and Tablename

Dim Pr_MyCon As System.Data.OleDb.OleDbConnection
Dim Pr_DataSet As DataSet
Dim Pr_DataAdapter As System.Data.OleDb.OleDbDataAdapter
Pr_MyCon = New System.Data.OleDb.OleDbConnection
Pr_DataSet = New DataSet("Temp")
Pr_MyCon.ConnectionString = "Provider=SQLOLEDB.1;IntegratedSecurity=SSPI;Persist Security Info=False;User ID=ppr;InitialCatalog=BMS;Data Source=SERVER1"
Pr_DataAdapter = New OleDb.OleDbDataAdapter("select * from CUSTOMER",Pr_MyCon)
Pr_DataAdapter.Fill(Pr_DataSet, "MyTable")

Regards

Partha

"shachar" <an*******@discussions.microsoft.com> wrote in messagenews:28****************************@phx.gbl...
hi all(i tried yesterday but it didnt work).
i wrote this code and i get an error msg:
Private Pr_MyCon As System.Data.OleDb.OleDbConnection
Private Pr_DataSet As DataSet
Private Pr_DataAdapter As
System.Data.OleDb.OleDbDataAdapter
Pr_MyCon = New System.Data.OleDb.OleDbConnection
Pr_DataSet = New DataSet("Temp")
Pr_MyCon.ConnectionString = "..."
Pr_DataAdapter = New OleDb.OleDbDataAdapter("select *
from MyTable", Pr_MyCon)
Pr_DataAdapter.Fill(Pr_DataSet, "MyTable")
the error msg saing:"An unhandled exception of
type 'System.Data.OleDb.OleDbException' occurred in
system.data.dll"

.

Nov 21 '05 #3
Hello

I used the same code to bind to a datagrid.
The code below is working.
Dim Pr_MyCon As System.Data.OleDb.OleDbConnection

Dim Pr_DataSet As DataSet

Dim Pr_DataAdapter As System.Data.OleDb.OleDbDataAdapter

Pr_MyCon = New System.Data.OleDb.OleDbConnection

Pr_DataSet = New DataSet("Temp")

Pr_MyCon.ConnectionString = "Provider=SQLOLEDB.1;Integrated
Security=SSPI;Persist Security Info=False;User ID=ppr;Initial
Catalog=BMS;Data Source=APHRODITE"

Pr_DataAdapter = New OleDb.OleDbDataAdapter("select * from CUSTOMER",
Pr_MyCon)

Pr_DataAdapter.Fill(Pr_DataSet, "MyTable")

Me.DataGrid1.SetDataBinding(Pr_DataSet, "MyTable")
Regards
Partha

"shachar" <an*******@discussions.microsoft.com> wrote in message
news:1a****************************@phx.gbl...
NO, i copied your code and i get the same error msg.
-----Original Message-----
Hello

You could try this, only you will need to change

Connection string and Table
name

Dim Pr_MyCon As System.Data.OleDb.OleDbConnection
Dim Pr_DataSet As DataSet
Dim Pr_DataAdapter As System.Data.OleDb.OleDbDataAdapter
Pr_MyCon = New System.Data.OleDb.OleDbConnection
Pr_DataSet = New DataSet("Temp")
Pr_MyCon.ConnectionString

= "Provider=SQLOLEDB.1;Integrated
Security=SSPI;Persist Security Info=False;User

ID=ppr;Initial
Catalog=BMS;Data Source=SERVER1"
Pr_DataAdapter = New OleDb.OleDbDataAdapter("select *

from CUSTOMER",
Pr_MyCon)
Pr_DataAdapter.Fill(Pr_DataSet, "MyTable")

Regards

Partha

"shachar" <an*******@discussions.microsoft.com> wrote in

message
news:28****************************@phx.gbl...
hi all(i tried yesterday but it didnt work).
i wrote this code and i get an error msg:
Private Pr_MyCon As System.Data.OleDb.OleDbConnection
Private Pr_DataSet As DataSet
Private Pr_DataAdapter As
System.Data.OleDb.OleDbDataAdapter
Pr_MyCon = New System.Data.OleDb.OleDbConnection
Pr_DataSet = New DataSet("Temp")
Pr_MyCon.ConnectionString = "..."
Pr_DataAdapter = New OleDb.OleDbDataAdapter("select *
from MyTable", Pr_MyCon)
Pr_DataAdapter.Fill(Pr_DataSet, "MyTable")
the error msg saing:"An unhandled exception of
type 'System.Data.OleDb.OleDbException' occurred in
system.data.dll"

.

Nov 21 '05 #4
Shachar,

To get more information you can try this

The code you use cannot be, therefore I assume that the private declaration
are outside a method and the rest in it.

Private Pr_MyCon As System.Data.OleDb.OleDbConnection
Private Pr_DataSet As DataSet
Private Pr_DataAdapter As
System.Data.OleDb.OleDbDataAdapter

Method sub or function
Pr_MyCon = New System.Data.OleDb.OleDbConnection
Pr_DataSet = New DataSet
Pr_MyCon.ConnectionString = "..."
Pr_DataAdapter = New OleDb.OleDbDataAdapter("select *
from MyTable", Pr_MyCon)
try
Pr_DataAdapter.Fill(Pr_DataSet, "MyTable")
catch ex as oledb.oledbexception
messagebox.show(ex.tostring)
catch ex as exception
end try
///
above typed in this message not tested and maybe with typos.

With this you get more information from the problem.
I assume it is a windowform application otherwise you should use the
console.write when you use VSNet or an extra label to show the ex.message on
a page when you use the notebook.

I hope this helps?

Cor
Nov 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Joey Liang via DotNetMonster.com | last post by:
Hi all, I am new in asp.net, i encounter some problems in using drop down list and datagrid. I have manage to bind the data into datagrid but i wanted to bind the data into the datagrid accroding...
6
by: Joey Liang via DotNetMonster.com | last post by:
Hi all, I have a drop down list which store all the different brands of product.When i selected the particular brand from the drop down list, it will display all the products with the selected...
1
by: Chris Kettenbach | last post by:
Hi All, Quick question. Can I use more than two tables as a source for a dataset? I am trying to fill a dataadpater but when I include more than two tables, it bombs out. Example:...
3
by: steve | last post by:
Hello, I have been trying to populate 2 or more controls from two *different* (related) tables for the last week without success. My latest try is: 2 simple SELECT statements in 2 adapters that...
2
by: Allen | last post by:
Hey all, I have a question for you all. I'm learning vb.net and need some help. I have two classes one named Customers and one named CustomersDA. I have to go though Customer for everything. I have...
1
by: ROBERT BEE | last post by:
Below is some code I have copied from the web with the intention of modifying but I keep getting the stated errors. This is the umpteenth attempt at trying to get OleDbConnection,OleDbDataAdapter...
0
by: Guy W via DotNetMonster.com | last post by:
I read and tried to use the repeater paging method I found on 4 Guys from Rolla (I've tried others also) but it doesn't seem to work. Please see the code I have below and tell me what I may be...
2
by: momo | last post by:
Hello Guys, I have a bit of a problem, I created a Dll called SecureQueryStringDll.dll and I had the dll put bin folder of my application first and it did not work so I then put it in the bin...
0
by: adnan1888 | last post by:
i want to display some data in a grid but this is the error i get. withEvents variable 'DataGrid1' implicitly defines '_DataGrid1', which conflicts with a member of the same name in class...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.