Questions tagged [sqlparameter]

a .NET class for representing SQL parameters in SqlCommands

SqlParameter is a noninheritable .NET class in the System.Data.SqlClient namespace whose instances represent a parameter for a SqlCommand.

319 questions
-4
votes
2 answers

SqlException was unhandled, C#

What should I do with this error? I used this code in selectall method and everything was fine, but in selectrow I get this error. Code: public DataTable SelectRow(string ContactID) { string query = "Select * from ContactsList Where ContactID =…
emeneitch
  • 1
  • 2
-5
votes
1 answer

An unhandled exception of type 'System.InvalidOperationException' occurred in System.Data.dll?

I'm getting an error and I don't know why! using(SqlConnection sqlcon = new SqlConnection(con)) { sqlcon.Open(); SqlCommand cmd = new SqlCommand("dbo.workScheduleDataGrid", sqlcon); cmd = sqlcon.CreateCommand(); cmd.CommandType =…
-5
votes
1 answer

How can I add members to an array of SqlParameter?

I've got this code: private SqlParameter[] GetSPParams() { SqlParameter[] spParams = null; int loopNum = 1; while (ParamExists(loopNum)) { //spParams. new SqlParameter() { ParameterName =…
-7
votes
1 answer

SQL parameters not working

This is the code I'm working with right now, I don't get any errors so I can't pinpoint where it's not working: private void btnAdd_Click(object sender, EventArgs e) { string constring = $"Data Source=(LocalDB)\\MSSQLLocalDB;AttachDbFilename="…
LooChar
  • 1
  • 2
1 2 3
21
22