Hello Srinath,
The data types depends upon the datasource which you are using.There is not much difference it depends upon which application language you are writing the code for
See here
This is the way to connect Oracle
Add a reference in the bin folder
Right Click bin folder -> Add Reference -> .NET -> Oracle.DataAccessClient
using Oracle.DataAccess.Client;
private void LoadData()
{
try
{
string ConString = "Data Source=XE;User Id=system;Password=*****;";
using (OracleConnection con = new OracleConnection(ConString))
{
OracleCommand cmd = new OracleCommand("SELECT * FROM table", con);
OracleDataAdapter oda = new OracleDataAdapter(cmd);
DataSet ds = new DataSet();
oda.Fill(ds);
if (ds.Tables.Count > 0)
{
dataGridView1.DataSource = ds.Tables[0].DefaultView;
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
Now same can be done fpr sql by just changing the Class of Oracle to SQL
import sql class
using System.Data.SqlClient;
using System.data;
then
private void LoadData()
{
try
{
string ConString = "Data Source=XE;User Id=system;Password=*****;";
using (SQLConnection con = new SQLConnection(ConString))
{
SQLCommand cmd = new SQLCommand("SELECT * FROM table", con);
SQLDataAdapter oda = new SQLDataAdapter(cmd);
DataSet ds = new DataSet();
oda.Fill(ds);
if (ds.Tables.Count > 0)
{
dataGridView1.DataSource = ds.Tables[0].DefaultView;
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
There is not much difference
Hope this helps
Regard's
Raj.Trivedi
"Sharing is Caring"
Please mark as answer if your Query is resolved
Srinathgb, if this helps please login to Mark As Answer. | Alert Moderator