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
Adesanya Olusegun
NA
19
26.7k
database query
Jun 22 2013 10:53 AM
my code here gives me an error "invalid sql statement expected insert, delete or update" and if i start the query with select it gives me an "ierrorinfo.getdescription failed with E_Fail(0x80004005)" error. please sir's and ma's i need an urgent help to this problem. thanks for your help
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Windows.Forms;
using
System.Data;
using
System.Data.SqlClient;
using
System.Data.OleDb;
using
System.ComponentModel;
using
System.Threading;
namespace
DiaryApps
{
static
class
Program
{
///
<summary>
///
The main entry point for the application.
///
</summary>
[
STAThread
]
static
void
Main()
{
bool
InstanceCountOne =
false
;
using
(
Mutex
mtex =
new
Mutex
(
true
,
"DiaryApps"
,
out
InstanceCountOne))
{
if
(InstanceCountOne)
{
Application
.EnableVisualStyles();
Application
.SetCompatibleTextRenderingDefault(
false
);
Application
.Run(
new
RegistrationForm
());
// what am trying to do here is load the registration page once and to load the Login page for other subsequent logins
OleDbConnection
newConnection;
OleDbCommand
cmd =
new
OleDbCommand
();
string
Connection =
@" provider=Microsoft.Jet.OLEDB.4.0; data source='Diarydatabase.mdb'; Jet OLEDB:Database Password= segunsco"
;
newConnection =
new
OleDbConnection
(Connection);
cmd.Connection = newConnection;
newConnection.Open();
try
{
cmd.CommandText =
"if exist(select [Flag] from [createdDetails]) begin select '1' end else begin select '0' end"
;
OleDbDataReader
MotReader = cmd.ExecuteReader();
if
(MotReader.HasRows ==
true
)
{
while
(MotReader.Read())
{
string
ty = MotReader.GetString(0);
if
(ty ==
"0"
)
{
Application
.Run(
new
RegistrationForm
());
}
else
if
(ty ==
"1"
)
{
Application
.Run(
new
Login
());
}
}
}
newConnection.Close();
}
catch
(
Exception
ex)
{
MessageBox
.Show(ex.Message);
}
}
else
{
MessageBox
.Show(
"An instance of the application is already running"
);
}
}
}
}
}
Reply
Answers (
1
)
Convert domain name to Punycode
What is the real use of abstract Class Please help me out