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
Ken H
NA
646
360.7k
Oracle sql statement parameters errors in c#
Apr 15 2012 1:06 PM
hi,
try
{
OracleCommand cmd = new OracleCommand();
conn.Open();
using (cmd = conn.CreateCommand())
{
cmd.CommandText = "select count(*) from User_Info where
Password=@p
";
cmd.Parameters.Add(new OracleParameter("@u",this.txtUser.Text));
cmd.Parameters.Add(new OracleParameter("@p",this.txtPassword.Text));
int i = Convert.ToInt32(cmd.ExecuteScalar());
if (i > 0)
{
this.Hide();
conn.Close();
}
else
{
conn.Close();
MessageBox.Show("the username or password is error!");
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
conn.Close();
}
Run-time, display the "illegal variable name / number"
thank very much.
Reply
Answers (
9
)
Fetch last 2 records from the table
Creating a valid HTML for XML reader using C#