If your database is SQL then try
String selQuery = "SELECT Id FROM MapDataImage WHERE Source = @t1 AND Destination = @t2";
SqlCommand cmd = new SqlCommand(selQuery);
cmd.Parameters.Add("@t1", TextBox1.Text);
cmd.Parameters.Add("@t2", TextBox2.Text);
Other databases do similar things - you just need to change the
SqlCommand
to the appropriate object, and be aware that not all DBMS' allow for named parameters