I am trying to query an access database and am getting problems before i really get going with this project!
Normally i am connecting to SQL so odbc is new ground to me, however i thought that handling connections was the same in .net.
I am doing the following...
logonCmd.CommandText = "SELECT intSystemAccess FROM SystemUsers WHERE chrUserName = @uName AND chrPassword = @pWord1";
logonCmd.Parameters.Add("@uName", OdbcType.VarChar, 50).Value = txtUname.Text;
logonCmd.Parameters.Add("@pWord", OdbcType.VarChar, 50).Value = txtPword.Text;
//normally i user logonCmd.Paramter.AddWithValue("@uName", txtUname.Text - but thought i would try the above after it //addWithValue failed.
I get Error 07002 Microsoft ODBC Access Driver - Too few parameters. Expected 2
When i do this...
logonCmd.CommandText = "SELECT intSystemAccess FROM SystemUsers WHERE chrUserName = '" + txtUname.Text + "' AND chrPassword = '" + txtPword.Text + "'";
It works fine??!! Can anyone shed any light on where i am going wrong?