Creating A Data-Bound Grid In C# With ADO.NET |
|
| |
| |
Data access is a core of most applications and an ability to efficiently access and modify a database is required for developers on a regular basis. In this article, you will look at accessing SQL-based data utilizing C# and ADO.NET and displaying the data in a data-bound grid control. |
| |
|
| |
using System.Data;
using System.Data.OleDb;
<code>
private void Form1_Load(object sender, System.EventArgs e)
{
string strConn, strSQL;
strConn = "Provider=Microsoft.JET.OLEDB.4.0;"
"data source=" "C:DataAccessNorthwind.mdb";
strSQL = "SELECT CompanyName, ContactName, ContactTitle, " ;
strSQL = strSQL "Address, City, Country FROM Customers";
OleDbDataAdapter da = new OleDbDataAdapter(strSQL, strConn);
DataSet ds = new DataSet();
da.Fill(ds, "Customers");
dataGrid1.DataMember = "Customers";
dataGrid1.DataSource=ds;
}
|
|
| |
|
|
| |
Date entered :
10th Jul 2007
Rating : No Rating
Accessed :
2337
Submitted by :
ahmedraza |
|
|
| |
|
|
| |
| |
|
Click each image to add this page to each site. |
|
|
| |
| |
|
| |
|
|
No comment available at the moment.Be the first one to make a comment
|
|
|
| |
|
|
Database error: Invalid SQL: select FLOOR( AVG(b.rating)) as avg_rating,a.sourcecode_id sourcecode_id ,title,description,author,category_id,skill_level,reference,reference_mail,reference_url,a.user_id user_id,date_entered,source,accessed,dev_id,file_url,total_comments,instruction,registered,authorised,fld_deletemark,fld_code_version,fld_searchkeyword,fld_code_status,category_id from tbl_sourcecode a LEFT JOIN tbl_sourcecodecomment b ON a.sourcecode_id = b.sourcecode_id LEFT JOIN tbl_codecategory c ON a.category_id = c.fld_categoryID where a.fld_deletemark = 'N' AND a.fld_enable_disable= 'Y' AND a.authorised='Y' AND c.fld_groupIDFK='13' AND a.sourcecode_id!='2975' GROUP BY a.sourcecode_id order by a.sourcecode_id DESC limit 0, 5
MySQL Error: 1030 (Got error 122 from storage engine)
Session halted.
Warning: Unknown(): write failed: Disk quota exceeded (122) in Unknown on line 0
Warning: Unknown(): Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0
| |