public DataTable Get_VISITER_MST_BY_ID(string id)
{
DataSet ds = new DataSet();
using (SQLiteConnection con = DBCONNECTION.Connection())
{
con.Open();
using (SQLiteDataAdapter da = new SQLiteDataAdapter("SELECT VISITER_ID, VISITER_IMAGE, VISITER_INTIME, VISITER_SCANTIME, VISITER_STATUS, VISITER_CANCELTIME, CONVERT(NVARCHAR(100),VISITER_SCANTIME, 100) AS TIME FROM VISITER_MST WHERE (VISITER_ID = '" + id + "'" + ")", con))
{
da.Fill(ds);
}
}
return ds.Tables[0];
}
Asked
Active
Viewed 4,362 times
1

Soner Gönül
- 97,193
- 102
- 206
- 364

Mistry Mehul
- 21
- 1
- 5
2 Answers
0
You are using SQLite. There is no datatype NVARCHAR
, Your current syntax is valid for SQL Server. In SQLite there is only text
datatype (for string) which is Unicode. See more about SQLite Data
Types.
Your current query has NVARCHAR(100)
which is interpretted as a method and hence the exception.
DATETIME
datatype in SQLite is stored as Numeric
. You may look at Date and Time functions in SQLite to get the Time Part from your field.
Also consider using Parameters for your query instead of string concatenation. See this question
0
SqlLite have not NVARCHAR it only allow text

Neeraj Dubey
- 4,401
- 8
- 30
- 49
-
so what we taken for datetime in sqlite? – Mistry Mehul May 08 '13 at 07:06
-
SQLite does not have a storage class set aside for storing dates and/or times. Instead, the built-in Date And Time Functions of SQLite are capable of storing dates and times as TEXT, REAL, or INTEGER values: TEXT as ISO8601 strings ("YYYY-MM-DD HH:MM:SS.SSS"). REAL as Julian day numbers, the number of days since noon in Greenwich on November 24, 4714 B.C. according to the proleptic Gregorian calendar. INTEGER as Unix Time, the number of seconds since 1970-01-01 00:00:00 UTC.[Reference Link](http://www.sqlite.org/datatype3.html) – Neeraj Dubey May 08 '13 at 07:09
-
so i only change in datetime insted of nvarchar in this query??then this problem will solve or not? – Mistry Mehul May 08 '13 at 07:14
-
As i told my earlier comment there is no specific datetime like SQL.In your quey please use text – Neeraj Dubey May 08 '13 at 07:16