-1
이 코드는 단추를 의미합니다.
그러나 언제든지 실행할 수있는 것은 ArgumentException was unhandled by user code
입니다.SqlConnection을 여는 중 ArgumentException이 발생했습니다.
충분한 데이터베이스가 있는지 확인하기 위해 데이터베이스를 검색하는 사이트입니다. TxtCity
가 txtCity
을해야한다는
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Configuration;
public partial class _Default : System.Web.UI.Page
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
protected void Page_Load(object sender, EventArgs e)
{
con.Open();
}
protected void Button1_Click(object sender, EventArgs e)
{
SqlCommand cmd = new SqlCommand("insert into Toner Values('"+txtFname.Text+"','"+txtLname.Text+"','"+TxtCity.Text+"')",con);
cmd.ExecuteNonQuery();
con.Close();
Label1.Visible = true;
Label1.Text = "Indsætning succesfuld!!!";
TxtCity.Text = "";
txtFname.Text = "";
txtLname.Text = "";
}
protected void TextBox3_TextChanged(object sender, EventArgs e)
{
}
}
당신은 더 구체적으로해야합니다. 코드가 끊어지는 라인은 무엇입니까? – NibblyPig
LINQTOSQL을 사용하고 있습니까? – gasroot
해당 내용이 다음과 같이 변경되었습니다. 'SqlConnection con = new SqlConnection (ConfigurationManager.ConnectionStrings [ "ConnectionString"]. ConnectionString);' 그리고 LINQTOSQL을 사용하지 마십시오. 방금 데이터베이스 로컬을 만들었습니다. –