I am trying to query the database and get it to return the correct data using the data that the user passes into the get request on my web API.
I have tried using:
SqlConnection con = new SqlConnection(conString);
con.Open();
if (con.State == System.Data.ConnectionState.Open)
{
SqlCommand cmd = new SqlCommand();
}
However, I am unsure of what I need the put in the command. Do I just write something like this:
WHERE forename, surname, caseid, postcode, telephone, email FROM TestDB.crm-data
Or am I mistaken?
This is the full code sorry
public string Get(string forename, string surname, int? caseid, int? loanid, string postcode, string telephone, string email, string title)
{
SqlConnection con = new SqlConnection(conString);
con.Open();
if (con.State == System.Data.ConnectionState.Open)
{
SqlCommand cmd = new SqlCommand("SELECT * FROM crm-base WHERE forename");
}
}
WHERE forename, surname, caseid, postcode, telephone, email FROM TestDB.crm-data?? did you meanSELECT forename, surname, caseid, postcode, telephone, email FROM TestDB.crm-data?