I am kinda new to C# and .NET applications. I work with visual studio and have this table :
CREATE TABLE [dbo].[Table] (
[Id] INT NOT NULL,
[Meno] NVARCHAR (50) NULL,
[Datum] DATETIME NULL,
[Cas] INT NULL,
PRIMARY KEY CLUSTERED ([Id] ASC)
);
And now I have a simple insert
public void NahrajSkore(string cas)
{
using (var con = new SqlConnection(cns))
{
con.Open();
var inset = new SqlCommand("Insert into Table values(@name,@date,@res)", con);
inset.Parameters.Add("@name", SqlDbType.VarChar);
inset.Parameters.Add("@date", SqlDbType.DateTime);
inset.Parameters.Add("@res", SqlDbType.Int);
inset.Parameters["@name"].Value = _hrac.MenoHraca;
inset.Parameters["@date"].Value = DateTime.Today;
inset.Parameters["@res"].Value = int.Parse(cas);
inset.ExecuteNonQuery();
}
}
BUt this method gives me error :
Incorrect syntax near the keyword 'Table'
What am I doing wrong ?