阅读背景:

无法保存数据c# Windows应用程序。

来源:互联网 

here is my code

这是我的代码

 private void button1_Click(object sender, EventArgs e)
    {
        try
        {
            string connectionString = @"Data Source=|DataDirectory|\Database_POS.sdf";
            using (SqlConnection connection = new SqlConnection(connectionString))
            using (SqlCommand command = connection.CreateCommand())
            {
                command.CommandText= "INSERT INTO Customer (Email) Values (@email);";
                command.Parameters.AddWithValue("@email",textBox_Email.Text);

                connection.Open();
                command.ExecuteNonQuery(); 
            }
        }

        catch (SqlException ex)
        {
            Console.WriteLine(ex.Message);
        }
    }  
 private void button



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: