Search : in
By :

Insert data using asp.net web application

ali, on Jun 17, 2009 7:11:28 am BST 
 Report this message to moderators

I want to insert data using asp.net web application through Sql 2005..

Code:

private void ConnectionDetails()
{
SqlConnection con = new SqlConnection("Data Source=ALIASGAR-EAE104;Initial Catalog=RajaCompany;Integrated Security=True;Database=RajaCompany;user id=sa;password=sql2005");
//con.Open();
//con.ConnectionString = "Data Source=ALIASGAR-EAE104;Initial Catalog=RajaCompany;Integrated Security=True;Database=RajaCompany;user id=sa;password=sql2005";

SqlCommand cmd = new SqlCommand("Insert * INTO Client Details(Client Name, Client Number, Client Email, Purpose, Qutation, Qutation Date, Client Address, Comments, Meeting Date) VALUES ( '" + txtClient.Text + "', '" + txtNumber.Text + "', '" + txtmail.Text + "', '" + txtpurpose.Text + "', '" + txtqutation.Text + "', '" + QutationCal.SelectedDate + "', '" + txtAddress.Text + "', '" + txtComments.Text + "', '" + MeetingCal.SelectedDate + "')", con);
con.Open();
DataSet ds = new DataSet();
cmd.ExecuteNonQuery();
}






//private object mbox(string p)
//{
// throw new Exception("The method or operation is not implemented.");
//}
protected void Button1_Click(object sender, EventArgs e)
{
//ClientDetailDataSource.Insert();
int score = Convert.ToInt32 (Validate());
// if (score < 7)
// {
// error_label.Visible = true;

// }
// else
// {
// error_label.Visible = false;
// Response.Redirect("ClientData.aspx?");
// }
if (score < 7)
{
error_label.Visible = true;

}
else
{
error_label.Visible = false;
SqlDataSource1.Insert();
Response.Redirect("ClientData.aspx?");
}
}

Configuration: Windows XP
Firefox 3.0.11

Best answers for « Insert data using asp.net web application » in :
Download ASP/PHP Web Application Builder Show ASP/PHP Web Application Builder is a simple database development application. Since it is very simple, it does not require any knowledge on programming, it easily allows you to create your databases with ASP and PHP languages. ASP/PHP Web...
ASP.NET using C# - How to Connect/Retrieve in database to web a ShowASP.NET using C# - How to Connect/Retrieve in database to web application Issue Solution Note Issue I am doing my project work, I have one problem My project doing in asp.net but I don't know how to connect the database in asp.net...
Uploading Large Files ShowUploading Large Files You have surely encountered various difficulties for sending files through e-mail due file limitation. You have found the elucidation to your trouble. There are several means to transfer files and data from one...
Connect a database (MDB) to excel Show[VBA] Connecting a database (MDB) to excel Below is a tips of how to connect an Access database (MDB) in an application excel Add reference Microsoft DAO object librairy X.X In a general module (eg Module1) paste the code below...
Download .NET Framework ShowMicrosoft .NET Framework 3.5 contains new features which have been built upon .NET Framework 2.0 and 3.0, and includes .NET Framework 2.0 service pack 1 and .NET Framework 3.0 service pack 1. Microsoft .NET Framework 3.5 includes: - ASP .NET AJAX...
Download MS SQL Data Wizard ShowMS SQL Data Wizard is a program which offers you, in a single interface, ASP.NET or PHP scripts which you need to handle data in your MS SQL Server database. These scripts are designed to be easy to understand and adapted to all types of users:...
Data tampering attacks ShowMost web application attacks involving soliciting a website with manually entered data to generate an unexpected context. Web application parameters The HTTP protocol, a communication protocol on the web, makes it possible to convey parameters in...
OOP - Data encapsulation ShowThe concept of encapsulation Encapsulation is a way of organising data and methods into a structure by concealing the the way the object is implemented, i.e. preventing access to data by any means other than those specified. Encapsulation...
Introduction - Databases ShowWhat is a database? A database (abbreviated DB) is an entity in which data can be stored in a structured manner, with as little redundancy as possible. Different programs and different users must be able to use this data. Therefore, the concept of...