-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsign.aspx.cs
60 lines (47 loc) · 1.43 KB
/
sign.aspx.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using System.IO;
public partial class sign : System.Web.UI.Page
{
string cs = WebConfigurationManager.ConnectionStrings["all"].ConnectionString;
protected void Page_Load(object sender, EventArgs e)
{
}
protected void sign_click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(cs);
SqlCommand cmd = new SqlCommand("account_insert", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@uname",sign_user.Value);
cmd.Parameters.AddWithValue("@pass", myFile.hash(sign_pass.Value));
cmd.Parameters.Add("@retvalue", SqlDbType.Int).Direction = ParameterDirection.Output;
try
{
con.Open();
cmd.ExecuteNonQuery();
}
//catch{}
finally
{
con.Close();
}
int result = (int)cmd.Parameters["@retvalue"].Value;
if (result == 0)
{
error.InnerHtml = "نام کاربری تکراری است";
error.Style.Add("color", "red");
}
else if (result == 1)
{
error.InnerHtml = "ثبت موفقیت آمیز";
}
}
}