here is the c# code which really helps you.
Showing posts with label Database. Show all posts
Showing posts with label Database. Show all posts
Friday, May 7, 2010
Demand note database application
this application was written in Farsi language.here is the C# code plus its compiled files.I used access database.here is the screenshots:
Saturday, May 1, 2010
How to use an sql query result
using System;
using System.Data;
using System.Data.SqlClient;
///
/// Demonstrates how to work with SqlConnection objects
///
class SqlConnectionDemo
{
static void Main()
{
// 1. Instantiate the connection
SqlConnection conn = new SqlConnection(
"Data Source=(local);Initial Catalog=Northwind;Integrated Security=SSPI");
SqlDataReader rdr = null;
try
{
// 2. Open the connection
conn.Open();
// 3. Pass the connection to a command object
SqlCommand cmd = new SqlCommand("select * from Customers", conn);
//
// 4. Use the connection
//
// get query results
rdr = cmd.ExecuteReader();
// print the CustomerID of each record
while (rdr.Read())
{
Console.WriteLine(rdr[0]);
}
}
finally
{
// close the reader
if (rdr != null)
{
rdr.Close();
}
// 5. Close the connection
if (conn != null)
{
conn.Close();
}
}
}
}
using System.Data;
using System.Data.SqlClient;
///
///
///
class SqlConnectionDemo
{
static void Main()
{
// 1. Instantiate the connection
SqlConnection conn = new SqlConnection(
"Data Source=(local);Initial Catalog=Northwind;Integrated Security=SSPI");
SqlDataReader rdr = null;
try
{
// 2. Open the connection
conn.Open();
// 3. Pass the connection to a command object
SqlCommand cmd = new SqlCommand("select * from Customers", conn);
//
// 4. Use the connection
//
// get query results
rdr = cmd.ExecuteReader();
// print the CustomerID of each record
while (rdr.Read())
{
Console.WriteLine(rdr[0]);
}
}
finally
{
// close the reader
if (rdr != null)
{
rdr.Close();
}
// 5. Close the connection
if (conn != null)
{
conn.Close();
}
}
}
}
Monday, April 26, 2010
Microsoft Access Essential Queries
Example 1:
Select * from customers
Example 2:
select * from customers where Country ='uk'
Example 3:
select City,Country from customers order by city
Example 4:
select City,Country from customers order by 1
Example 5:
select distinct City,Country from customers order by 1
Example 6:
Select Count(*) from Customers where Country ='uk
Example 7:
Select sum(Quantity) from[order details] where productid = 11
Example 8:
Select productid, sum(Quantity) as sum_qty from [Order Details] group by productid
Subscribe to:
Posts (Atom)