473,396 Members | 1,827 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#-Get data from database into Datagridview Row

Dear All,

I have a datagridview has many columns inside.
I would like to retrieve data from database into all columns that I have already created.

How to do it?
If I used this below code, it will get all data from database into datagridview by adding many new columns

------
Expand|Select|Wrap|Line Numbers
  1. myConnection myCon1 = new myConnection();
  2. myCon1.openConnection();
  3. string query1 = "SELECT * FROM tblContractDetail WHERE Contract_No = @value1";
  4. OleDbParameter sp = new OleDbParameter("value1", OleDbType.VarChar);
  5. sp.Value = valuesearch;
  6. DataTable dt = myCon1.executeSelectQuery(query1, new OleDbParameter[] { sp });
  7. dgvContractDetail.DataSource = dt;
-------
May 28 '13 #1
0 1747

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

Similar topics

2
by: Jake_adl | last post by:
Is there any way to create a Microsoft.Practices.EnterpriseLibrary.Data.Database object without reading from a configuration file? I am writing a utility that manages databases in SQL Server....
3
by: abc my vclass | last post by:
There are some programs written on .NET 1.1. These applications are apply n-tiers contains Data Access Layers or Business Logic Layer. Now, our company upgrade to .NET 2.0 and enhance or rewrite...
1
by: ashik478 | last post by:
Hi! I have a problem. I have a table in oracle database with one field is primary key. Now I want to insert data from Datagridview with hide column which contain not null field(this field is...
1
by: weird0 | last post by:
How can i update the data in my database directly through datagridview....? Can anyone tell me the appropriate links and what is the exact event in datagridview that handles it and some explanation...
14
by: wassssup | last post by:
hi guys..im new to datagridview and im wondering is there a way to convert an encrypted data in access and show it in a datagridview? im using C# and microsoft access normally this is how to show...
4
by: shripal | last post by:
hello, i am new to c#.net. i have imported data in datagridview form ms access database. now i want to store each row of datagridview saperatly in string array so in saperate class i...
1
by: progvar | last post by:
Hi i want to update data in database using datagridview actually i am displaying the data in datagridview and after that i want to update some rows data directly modifying the displayed data into...
1
by: thesti | last post by:
hello, i usually simply use DataAdapter or DataReader to get data from database.now, i'm thinking to use ORM to help ease OO development. but then because i have the need to display the data...
0
by: premMS143 | last post by:
Hi, I have created application using VB.net & backend MS Access. During run time I add certain rows of data to Datagridview. After finalizing it I want to update those data present in datagridview...
0
by: Arnold Agolli | last post by:
Hello! Can sb explain me how to connect to a .accdb database and on Form_Load to display its data in DataGridView!(i want this in odbc because in oledb it didnt work because im using 64-bit windows...
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: 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:
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...
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.