TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Danish Habib
NA
694
244.3k
Using sybase Database advantage database server
Oct 15 2015 3:36 AM
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
Error 5111: The parameter name specified was invalid for the statement. UserID
below is my code
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
Reply
Answers (
0
)
Display Column AS Row Of GRidview
Need a login Application in 2008 using smart device appli..