دة اكود اللى انا كتبة ولما بعمل run بتظهرلى المشكلة دة ؟
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace test
{
public partial class Form1 : Form
{
SqlConnection con = new SqlConnection();
SqlCommand cmd = new SqlCommand();
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
con.ConnectionString = @"Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|qq.mdf;Integrated Security=True;User Instance=True";
con.Open();
}
private void button1_Click(object sender, EventArgs e)
{
cmd.CommandText = "insert into soso(@name)values('" + textBox1.Text + "')";
cmd.ExecuteNonQuery();
con.Close();
}
}
}