sammySeltzer
asked on
What is wrong with this function?
I have this function which calls a stored procedure the pulls records from the database.
This stored procedure takes one parameter, pid:
Then I am trying to call this function on pageload event but it is giving me an error:
string pid = Session["PID"].ToString();
getRecs(pid);
This is the error:
Error 1 The best overloaded method match for 'getRecs(int)' has some invalid arguments
Any ideas?
This stored procedure takes one parameter, pid:
private void getRecs(int pid)
{
SqlConnection conn = new SqlConnection(connStr);
//Dim cmd As New SqlCommand(s, conn) switched to stored proc below
SqlCommand cmd = new SqlCommand("[uspGetAllRecs]", conn);
cmd.CommandType = CommandType.StoredProcedure;
SqlParameter p1 = new SqlParameter("@pid", pid);
cmd.Parameters.Add(p1);
conn.Open();
cmd.ExecuteNonQuery();
conn.Close();
}
Then I am trying to call this function on pageload event but it is giving me an error:
string pid = Session["PID"].ToString();
getRecs(pid);
This is the error:
Error 1 The best overloaded method match for 'getRecs(int)' has some invalid arguments
Any ideas?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Awesome!
It worked.
Thank you very much
It worked.
Thank you very much
ASKER
This always for the providing quick solutions to my questions.
As usual, your solution is perfect.
Thanks alot