【发布时间】:2019-02-13 14:36:34
【问题描述】:
好吧,我是数据库新手,我还在学习,所以我的 sql 本地数据库在我需要的电脑帮助上运行良好。
为了让它工作,我每次都必须手动串起来
public partial class adminLogin : System.Web.UI.Page
{
SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\UsersSuren\Documents\Visual Studio 2012\Projects\Shopee mobile\Shopee mobile\App_Data\shopping.mdf;Integrated Security=True");
int i;
protected void Page_Load(object sender, EventArgs e)
{
}
protected void b1_Click(object sender, EventArgs e)
{
con.Open();
SqlCommand cmd = con.CreateCommand();
cmd.CommandText = "select * from admin_login where username='"+t1.Text+"' and password='"+t2.Text+"'";
cmd.ExecuteNonQuery();
DataTable dt = new DataTable();
【问题讨论】:
-
您的实际问题是什么?请在必要的部分更具体,而不是在开头详细:) 请查看“How to ask”以获得帮助
-
欢迎来到 SO。 Karthik 大声笑,尝试查看@AlexK 的链接。张贴在他/她的评论中。它应该有助于回答您的问题,因为有一篇帖子获得了 80 多票。
标签: c# asp.net visual-studio-2012