csvの読み込みはMicrosoft.VisualBasic.FileIO.TextFieldParserを使う
Microsoft.VisualBasic.FileIO.TextFieldParser
なんとなく書いてみただけなので参考になるかわかりませんが、あとちゃんと動くかわからないけど、csvをいい感じにIteratorで返してくれるやつ
parserの設定は要件にあわせて適宜指定してください
Public Iterator Function Context(path As String, Optional encoding As System.Text.Encoding = Nothing) As IEnumerable(Of String())
Try
Using stream As System.IO.FileStream = New System.IO.FileStream(path, System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.Read)
Using parser As FileIO.TextFieldParser = New FileIO.TextFieldParser(stream, IIf(encoding Is Nothing, System.Text.Encoding.UTF8, encoding), True, False)
With parser
.TextFieldType = FileIO.FieldType.Delimited
.Delimiters = New String() {","}
.HasFieldsEnclosedInQuotes = False
.TrimWhiteSpace = False
End With
While (parser.EndOfData = False)
Yield parser.ReadFields
End While
End Using
End Using
Catch ex As Exception
End Try
End Function
SQLiteはSystem.Date.SQLiteをnugetから取ってきて使う
System.Data.SQLite
こっちはさわりだけですけどsqllite.dbというSQLiteのデータベースにDummyというテーブル、Key,Valueというフィールドがあったとして
Using db As New System.Data.SQLite.SQLiteConnection("Data Source=sqllite.db")
db.Open()
Using SqlCommand As System.Data.SQLite.SQLiteCommand = con.CreateCommand()
SqlCommand.CommandText = "INSERT INTO Dummy (Key, Value) VALUES(1, 'teratail')"
SqlCommand.ExecuteNonQuery()
End Using
End Using
サンプルなので直書きしているけど、パラメータクエリで次々値を渡して実行してあげる
INSERT INTO Dummy (Key, Value) VALUES(@Key, @Value)
パラメータクエリは以下を参考に
SqlCommand.Parameters
であとはひたすら頑張ってコードを書けばいい感じになるかと..