LinkOps
LinkOps

Reputation: 341

Error 5: Cannot implicitly convert type 'System.Data.DataSet' to 'System.Data.SqlClient.SqlDataAdapter'

Sorry for the noobiness here but I'm having an issue with the following SQL connection in C# asp.net

   #region Get Employee Logins

    DataSet ds_Logins;
    SqlDataAdapter da_Logins;

    SqlCommand cmdLogins = new SqlCommand("IFACE_SB_EMPLOYEE", SBConn.sbConn);
    cmdLogins.Parameters.Add("@Statement", SqlDbType.Char).Value = "GetLogins";
    cmdLogins.Parameters.Add("@i_FK_EmployeeID", SqlDbType.Char).Value = Request["i_FK_EmployeeID"].Trim().ToString();
    cmdLogins.CommandType = CommandType.StoredProcedure;

    da_Logins = new SqlDataAdapter(cmdLogins);

    try
    {
        SBConn.sbConn.Open();

        da_Logins = new DataSet();
        int row = da_Logins.Fill(ds_Logins, "SB_SST_EXCHANGERATE");

        if (row <= 0)
        {
        }
        else
        {
            GridViewSystemsLogin.DataSource = ds_Logins.Tables[0];
            GridViewSystemsLogin.DataBind();
        }

        SBConn.sbConn.Close();

    }
    catch (Exception )
    {
    }

    #endregion

Can anybody help me with what the pickle is wrong we it seeing as its been copied from an existing working file and re-jigged in the stored procedure and table aspects.

Thanks

Marcus

Upvotes: 0

Views: 2656

Answers (1)

Heinzi
Heinzi

Reputation: 172230

This line

da_Logins = new DataSet(); 

should read

ds_Logins = new DataSet(); 

Upvotes: 7

Related Questions