Hello, Everyone! I am currently struggling with MySQL database with DataSet. The thing is that it uses loads of memory(as I found somewhere over the net it uses almost 4x memory rather than when you are using DataReader). What I was thinking is to make a function that will use DataReader for the SQL SELECT command.
What I am currently thinking of is(example):
public void GetData(string name,string surname, string company)
{
string selectCommand="";
selectCommand += "SELECT * FROM thetable ";
if (txtName.Text!="" || txtSurname.Text!="" || txtCompany.Text!="")
selectCommand += "WHERE ";
if (txtName.Text!="")
selectCommand += "name=" + txtName.Text+ " ";
if (txtSurname.Text!="")
selectCommand += "surname=" + txtSurname.Text + " ";
if (txtCompany)
selectCommand += "company=" + txtCompany.Text + " ";
MySqlDataAdapter dataAdapter = new MySqlDataAdapter(selectCommand+";",conn);
///etc...
}
But I feel that it's a wrong way. First of all I am not using parametrs. The second thing is that it looks kinda dirty. Can anyone please suggest something.