José Couto
New member
- Joined
- Nov 14, 2024
- Messages
- 2
- Programming Experience
- Beginner
SQL Server Management Studio 20 Database
Windows AuthenticationI'm using Visual Studio 2022
it seems that it doesn't recognize the commands, can someone help me?
Windows AuthenticationI'm using Visual Studio 2022
it seems that it doesn't recognize the commands, can someone help me?
C#:
string strCon = "Data Source=DESKTOP-FA03T93;Initial Catalog=Controle_Manejo_ASF; Trusted_Connection=True; Encrypt=False";
try { using (SqlConnection cn = new SqlConnection(strCon)) { cn.Open();
string strSQL = @"INSERT INTO [dbo].[Caixa] ([ID_Caixa])“; VALUES (@cx1)";
SqlCommand cm = new SqlCommand(strSQL, cn);
cm.Parameters.Add(new SqlParameter("cx1", ID_Caixa.Text));
cm.ExecuteNonQuery();
cn.Close();
MessageBox.Show("Inclusion successful", “Box”, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}
catch (Exception ex)
{
MessageBox.Show("Error Adding Box", “Box”,
MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
Last edited by a moderator: