Name varchar(30),
Single float
Id
|
Name
|
Single
|
1
|
Rustam
|
0,25
|
2
|
Firuz
|
0,75
|
3
|
Asror
|
0,95
|
4
|
Sadriddin
|
1,75
|
Have to textbox in widows form application C#.
I want insert name and single value float, but it’s not save float.
I used below code:
public void adddegr(string nm, double sng)
{
SqlCommand cmd = con.CreateCommand();
cmd.CommandText = "insert into People(name, single)values(N'" + nm + "'," + sng + ")";
con.Open();
try
{
cmd.ExecuteReader();
}
catch { }
con.Close();
}
In button_click
adddegr(name.Text, Convert.ToDouble( single.Text));