Hi Juan,
Here the steps to connect with Sqlserver.
Web.Config
<connectionStrings>
<remove name="CON"/>
<add name="CON" providerName="System.Data.SqlClient" connectionString="server=YourServerName;database=YourDBName;uid=YourUserID;password=YourPwd;"/>
</connectionStrings>
.cs
static string constr = ConfigurationManager.ConnectionStrings["CON"].ConnectionString.ToString();
SqlConnection con = new SqlConnection(constr);
SqlCommand cmd;
cmd = new SqlCommand("YourProcedureName", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@QryId", "UPDATE");
cmd.Parameters.AddWithValue("@Price", Param1);
cmd.Parameters.AddWithValue("@Option", Param2);
if (CurrDate != DateTime.MinValue)
{
cmd.Parameters.AddWithValue("@CurrDate", Param3);
}
else
{
cmd.Parameters.AddWithValue("@CurrDate", System.Data.SqlTypes.SqlDateTime.Null);
}
con.Open();
result = cmd.ExecuteScalar().ToString();
cmd.Parameters.Clear();
cmd.Dispose();
con.Close();
For More Connections String, please check the following link:
http://www.connectionstrings.com/[
^]