I have a simple desktop application in c sharp with SQL Server now i want to shift from SQL TO ADVANTAGE DB server below is my code but it gives error
public ClsUserLoging IsValidLog(string UserID, string PassWord)
{
try
{
objClsUsers = null;
string connectionString = DMS_2008_Data.Properties.Settings.Default.DataConnection.ToString();
// DMS.Properties.Settings.Default.ConnectionString;
con = new AdsConnection("data source=c:\\DMS2008.add;" +
"ServerType=remote|local; TableType=ADT");
con.Open();
//objClsUsers = null;
// con = new SqlConnection(ConfigurationManager.ConnectionStrings["DMS_2008_Data.Properties.Settings.Default.DataConnection"].ToString());
//string conn="Data Source=ASPKCO-DANISH\\SQLEXPRESS1;Initial Catalog=DMS2008;Integrated Security=True;Connect Timeout=300;MultipleActiveResultSets=True;";
//con = new SqlConnection(conn);
// Properties.Settings.Default.Save();
// con.Open();
com = new AdsCommand();
com.Connection = con;
com.CommandType = CommandType.Text;
com.CommandText = "SELECT UserName, IsNever, CreateDate, ValidDays, ExpireDate FROM UsersDetails WHERE (UserID = @UserID) AND (UserPassWord = @UserPassWord)";
com.Parameters.Add("@UserID", SqlDbType.NVarChar).Value = UserID.ToString().Trim();
com.Parameters.Add("@UserPassWord", SqlDbType.NVarChar).Value = PassWord.ToString().Trim();
reader = com.ExecuteReader();
while (reader.Read())
{
objClsUsers = new ClsUserLoging();
objClsUsers.UserName = reader.GetString(0).ToString();
objClsUsers.Never = reader.GetBoolean(1);
objClsUsers.CreateDate = reader.GetDateTime(2);
objClsUsers.ValidDays = (short)reader.GetInt32(3);
objClsUsers.ExpireDate = reader.GetDateTime(4);
}
reader.Close();
com.Parameters.Clear();
}
catch (Exception ex)
{
objClsUsers = null;
throw ex;
}
finally
{
if (com != null)
com.Dispose();
if (con != null)
con.Dispose();
com = null;
con = null;
}
return objClsUsers;
}
}
is there any difference in passing parameters using Adscommand instead of sqlcomand any example using advantage database please share