473,396 Members | 1,714 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,396 software developers and data experts.

C# dataGridView doesn't display table components?

hello!
i tried to create a database program in c# in windows forms and i put a datagridview to the form!

than on form_load i put this code:

String strConnect = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\********\Desktop\Numeratori.mdb";
SqlConnection objConnect = new SqlConnection(strConnect);

String strQuery = "SELECT * FROM tabela";
SqlCommand objCommand = new SqlCommand(strQuery, objConnect);
SqlDataAdapter objDataAdapter = new SqlDataAdapter(objCommand);

DataTable objDataTable = new DataTable();
objDataAdapter.Fill(objDataTable);
objConnect.Close();

dataGridView1.DataSource = objDataTable;

i dont have any problem with the naming! i also tried it to make the connection with the ide but still doesnt display the information in the table!

thank you! :D
Mar 20 '11 #1
1 2109
Aimee Bailey
197 Expert 100+
I don't believe SqlConnection supports MS Access database files, you could instead use the OdbcConnection, OdbcCommand and OdbcDataAdapter found in Microsoft.Data. This should do the trick.

Aimee.
Mar 20 '11 #2

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

Similar topics

10
by: Peter Pfannenschmid | last post by:
Hi folks, it's me again... since I have learned many things with the help of you, I have put together an example which is compliant to XHTML 1.0 strict and to CSS 2, but isn't shown at all in...
1
by: Paul Barry | last post by:
Using this code: <html> <body bgcolor="#CCCCCC"> <table cellpadding="0" cellspacing="0" border="0" width="100%"> <tr id="theGreenRow"> <td width="100%" bgcolor="#00FF00"...
0
by: Richard | last post by:
Hello. In VB .NET I have a class derived from ListView like this: Public Class ListViewSorted Inherits System.Windows.Forms.ListView 'code to make this ListViewSorted class sortable... End...
7
by: Robert Blasius | last post by:
Hello, I've a problem displaying a header content in Internet Explorer. You can view the problem on www.robert-blasius.de The upperimage should be on the left of the middle "line" and the lower...
3
by: Samuel R. Neff | last post by:
I just started having a problem with the Add Reference dialog not displaying in VS.NET 2003. Whenever I click Add Reference the dialog doesn't display. I've tried several different projects and...
2
by: Ivan | last post by:
I have a class Foo which have two property. I have a thread that do some process and update class Foo int B. I have a datagridview on main form. this datagridview data source to this class Foo and...
5
by: Brett Romero | last post by:
I have a simple test app with one form, one datagridview, and a contextmenustrip. I've assigned the menustrip to the datagridview and given the grid one column. There isn't any data in the grid. ...
1
by: prashanthjthomas | last post by:
by clicking purticular column in a datagridview how to display combobox
2
by: jimmygyuma | last post by:
Windows XP Media Center - Python 2.5 - wxPython 2.8 Code ... bmp = wx.Image("images\\new24.bmp", wx.BITMAP_TYPE_BMP).ConvertToBitmap() print str(bmp.GetWidth()) self.fileNewItem =...
0
by: anureddy | last post by:
help me how to add datagridview columns to another table,using windowsapplications. and set the displaymember and value member datagridviewcomboboxcolumn. i used this below code but that not...
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
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
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,...
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.