Hello Sir,
I have below code in C# with Connection String and using store procedure with @JobID but its not working. Could tell me where im making the mistake please....
C# Code:----------------
string strCon = @"Data Source=FARRUKH\SQLEXPRESS;Initial Catalog=DLCallLog;Integrated Security=True";
SqlConnection myConnection = new SqlConnection(strCon);
myConnection.Open();
SqlCommand myCommand = new SqlCommand("AddModifySP", myConnection);
myCommand.Connection = myConnection;
myCommand.CommandType = CommandType.StoredProcedure;
int job1 = 6;
myCommand.Parameters.AddWithValue("@JobID", job1);
SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand = myCommand;
DataSet ds = new DataSet();
da.Fill(ds, "Results");
myConnection.Close();
myConnection.Dispose();
myCommand.Dispose();
Store Procedure:--------------------
CREATE PROCEDURE [dbo].[AddModifySP]
(
@JobID int
)
AS
SET NOCOUNT ON;
SELECT
[CLIENT NAME],
[JOB NUMBER],
[JOB ADDRESS],
[CONTACT NUMBER],
[JOB TYPE],
[JOBID]
FROM
DBO.[CLIENT TABLE]
WHERE
[JOBID] = @JobID