public static void InsertCustomer(string FName,string LName,string Email,string Location)
{
string sqlConnString = null;
// Get connection string
sqlConnString = ConfigurationSettings.AppSettings["dbConn"].ToString();
using (SqlConnection sqlConn = new SqlConnection(sqlConnString))
{
try
{
//Create command.
SqlCommand command = new SqlCommand("usp_InsCustomer", sqlConn);
command.CommandType = CommandType.StoredProcedure;
command.CommandTimeout = 30;
//Build parameter list.
command.Parameters.Add(new SqlParameter("@FName", SqlDbType.NVarChar, 256));
command.Parameters.Add(new SqlParameter("@LName", SqlDbType.NVarChar, 256));
command.Parameters.Add(new SqlParameter("@Email", SqlDbType.NVarChar, 256));
command.Parameters.Add(new SqlParameter("@Location", SqlDbType.NVarChar, 256));
//command.Parameters.Add(new SqlParameter("@IPAddress", SqlDbType.NVarChar, 256));
//Add values for the parameters.
command.Parameters[0].Value = FName;
command.Parameters[1].Value = LName;
command.Parameters[2].Value = Email;
command.Parameters[3].Value = Location;
command.Parameters[4].Value = NumberOfHugs;
//command.Parameters[5].Value = IPAddress;
//Open Connection
sqlConn.Open();
//Fire Command
command.ExecuteNonQuery();
}
catch (Exception ex)
{
//Eat exception
}
}
}
Tuesday, August 31, 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment