0
私はデータベースと3ページの登録を受けました&ログインフォーム& 3番目は私のユーザー名の間の宝くじです。 エラーはありませんが、データベース全体が使用されていないので、 データベースからの保存やロードは行われません。私のプログラムはデータベースに情報を保存したりロードしたりしません
これは私の登録フォームです:あなたのコード
con.Open();
Label4.Text ="ثبت نام با موفقیت انجام شد".ToString();
Label4.Visible = true;
con.Close();
com.ExecuteNonQuery();
で
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _2 : System.Web.UI.Page
{
protected void btnRegister_Click(object sender, EventArgs e)
{
string strcon = "Data Source=.;uid=sa;pwd=123;database=Login_Register";
SqlConnection con = new SqlConnection(strcon);
SqlCommand com = new SqlCommand("strlogin", con);
com.CommandType = System.Data.CommandType.StoredProcedure;
SqlParameter p1 = new SqlParameter("username", txtUserName.Text.ToString());
SqlParameter p2 = new SqlParameter("email", txtEmail.Text.ToString());
SqlParameter p3 = new SqlParameter("password", txtpassword.Text.ToString());
com.Parameters.Add(p1);
com.Parameters.Add(p2);
com.Parameters.Add(p3);
con.Open();
Label4.Text ="ثبت نام با موفقیت انجام شد".ToString();
Label4.Visible = true;
con.Close();
com.ExecuteNonQuery();
}
private SqlDbType ToString(object text)
{
throw new NotImplementedException();
}
}
public class Label4
{
internal static object Text;
internal static bool Visible;
}
public class txtUserName
{
internal static object Text;
internal static bool Visible;
}
public class txtEmail
{
internal static object Text;
internal static bool Visible;
}
public class txtpassword
{
internal static object Text;
internal static bool Visible;
}
言及の問題を開くことができません。 DBに接続できますか?データベースに保存するコードはどこですか?ストアドプロシージャの名前です。あなたの質問は非常に幅広く、私たちはそれをデバッグすることはできません。だから具体的にしてください。 – MKR
"Strlogin"は私が でデータベースログインをチェックしたルーチンの名前です。また、テーブルも見ることができるよりもデータベースを作成しました 問題は「文字列strcon」です。 作品と私はそれを間違って書きましたか? – ali