问题描述
usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Text;usingSystem.Windows.Forms;namespaceRFID{publicpartialclassAddView:Form{publicAddView(){InitializeComponent();}System.Data.SQLite.SQLiteConnectionconn=newSystem.Data.SQLite.SQLiteConnection();System.Data.SQLite.SQLiteConnectionStringBuilderconnstr=newSystem.Data.SQLite.SQLiteConnectionStringBuilder();System.Data.SQLite.SQLiteCommandcmd=newSystem.Data.SQLite.SQLiteCommand();stringsql="";privatevoidAddView_Load(objectsender,EventArgse){stringdatasource="d:/testing.db";//System.Data.SQLite.SQLiteConnection.CreateFile(datasource);connstr.DataSource=datasource;conn.ConnectionString=connstr.ToString();conn.Open();cmd.Connection=conn;//sql="insertintomainvalues(1,'aa','aa','aa','aa','aa')";//cmd.CommandText=sql;//cmd.ExecuteNonQuery();sql="select*frommain";cmd.CommandText=sql;cmd.ExecuteNonQuery();System.Data.SQLite.SQLiteDataReaderreader=cmd.ExecuteReader();}}}
解决方案
解决方案二:
没有把问题描述清楚。。。是不是没有执行reader.Read()就去操作reader的数据去了。