Good afternoon,
I have the following code in my *.razor.cs file to write a value to my database:
public void WriteTag(string sTagName, string sValue)
{
try
{
string connectionstring = "Data Source=localhost;Initial Catalog=HMI_DB;User ID=sa;Password=sa;";
using (SqlConnection con = new SqlConnection(connectionstring))
{
con.Open();
using (SqlCommand cmd = new SqlCommand("", con))
{
//cmd.CommandText = "insert into dbo.CommandQueue values ('" + sTagName + "', '" + sValue + "', 1,'" + DateTime.Now.ToString() + "')";
cmd.CommandText = "insert into dbo.CommandQueue values ('" + sTagName + "', '" + sValue + "', 1,'1-2-2021')";
//Console.WriteLine(DateTime.Now);
cmd.ExecuteNonQuery();
}
con.Close();
}
}
catch (Exception ex)
{
}
}
}
Now I have a TextBox in my application that should write a value with the Invoke Method option. But when I use the statement ${InputNewBatchIdChange}
I'm getting an error: error CS0428: Cannot convert method group 'InputNewBatchIdChange' to non-delegate type 'object'. Did you intend to invoke the method?
Note that my TextBox has the name InputNewBatchID
.
Can you help me further how to write an input value correctly using the TextBox (or another component)?
Thanks in advance!