Tech
Forums
Jobs
Books
Events
Videos
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Contribute
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
3
Answers
How to use two select query ado.net c#?
Mani Kandan
8y
255
1
Reply
Hello Everyone,
I want to select full data from First query and only select count from Second query. After, I want to get these both query result in to the
userList
But, now getting error:- "
SQL logic error or missing database
near "select": syntax error
"
string
sql =
"SELECT * FROM Tble_UserSetUp inner join Tble_Login on Tble_UserSetUp.Id = Tble_Login.UserId WHERE Tble_Login.UserId='"
+ Userid +
"'"
;
sql +=
"select count(*) from Tble_UserSetUp inner join Tble_Documents on Tble_Documents.UserId = Tble_UserSetUp.Id where Tble_Documents.UserId ='"
+ Userid +
"'"
;
DataTable dt =
new
DataTable();
DataTable dt1 =
new
DataTable();
// DataSet ds = new DataSet();
try
{
using
(SQLiteConnection con =
new
SQLiteConnection(dbConnection))
{
using
(SQLiteCommand cmd =
new
SQLiteCommand(sql))
{
using
(SQLiteDataAdapter da =
new
SQLiteDataAdapter())
{
cmd.Connection = con;
da.SelectCommand = cmd;
using
(DataSet ds =
new
DataSet())
{
da.Fill(ds);
dt = ds.Tables[0];
dt1 = ds.Tables[1];
}
}
}
con.Close();
}
var userList = from myRow
in
dt.AsEnumerable()
where myRow.Field<
bool
>(
"IsActive1"
) ==
true
select myRow;
Post
Reset
Cancel
Answers (
3
)
Next Recommended Forum
How to Convert System.Drawings.Bitmap to stdole.IPictureDisp
Visual Studio 2015 crashes on startup...