If you have developed a web site project and you are forced to convert the same to web
Application. Then you can follow the steps mentioned Here..
This works perfect. It is converting the application without any error
Happy Coding
April 9, 2008
If you have developed a web site project and you are forced to convert the same to web
Application. Then you can follow the steps mentioned Here..
This works perfect. It is converting the application without any error
Happy Coding
March 14, 2008
Hi all,
Here I am going to display how to update the datatable to the underlaying sqltable….
I am using the VS2005 and SQL as the BackEnd
SqlCommand sqlcmd = new SqlCommand("Select * from customers"); //Using the northwhind
//SqlConnection is class which will open the connection to Northwind Database
sqlcmd.Connection = SQLConnections.sqlCon;
SqlDataAdapter sqda = new SqlDataAdapter(sqlcmd);
DataTable dtTemp = new DataTable();
SqlCommandBuilder sqlbuilder = new SqlCommandBuilder(sqda);
SQLConnections.OpenConnection();
sqda.Fill(dtTemp); //fill the values returned into temp data table
DataRow dr = dtTemp.NewRow(); //Creating a new row
dr["CustomerID"] = "100"; //Add the custumer id //Required
dr["CompanyName"] = "SolidSollutions"; //Adding the companyName
dr["ContactName"] = "Danasegarane";
dr["ContactTitle"] = "Programmer";
dr["Address"] = "India";
dr["City"] = "India";
dr["Region"] = "India";
//I have left other columns fields because they are not the mandatory one
dtTemp.Rows.Add(dr); //Adding the row to the datatable
sqda.Update(dtTemp); //Update the related dataadapeter
sqda.Dispose(); //dispose
SQLConnections.CloseConnection();
The SQLConnection Class which is used in the previous code
public class SQLConnections
{
public enum ReturnType { ExcuteNonQuery = 1, ExcuteScallar = 2, ExcuteReader = 3, ExcuteXMLReader = 4,ExcuteDatatable=5 };
public static SqlConnection sqlCon;
public static string strErrorDescription = string.Empty;
public static void OpenConnection()
{
string SQLServerName = string.Empty;
string SQLDataBase = string.Empty;
string SQLConnectionString = string.Empty;
SQLServerName = ConfigurationManager.AppSettings["SQLServerName"];
SQLDataBase = ConfigurationManager.AppSettings["SQLDataBase"];
SQLConnectionString += "data source=" + SQLServerName + ";";
SQLConnectionString += "initial catalog=" + SQLDataBase + ";";
SQLConnectionString += "user id=sa;Password=test;";
SQLConnectionString += "persist security info=True ";
sqlCon = new SqlConnection(SQLConnectionString);
try
{
if (sqlCon.State == ConnectionState.Closed)
{
sqlCon.Open();}
}
catch (Exception ex)
{
strErrorDescription = ex.Message;
}
}
Hope this helps to some one
For more info Please refer : SQLCommandBuilder
February 26, 2008
This Article from Explains the process of exporting a datagrid to excel. Hope this helps to some one
How To Export Data in a DataGrid on an ASP . NET WebForm to Microsoft Excel
February 7, 2008
I found this article to maintain the checkbox state during paging in datagridview. This works well.
Hope this is useful to u