Hi,
I'm a newbiz in sqlite (and in C#)... and I try to find an answer on google and this fourm before posting.
Since some months (when I have time) I try to learn C#. I give myself a goal to learn the language : write a text gui game, I was thinking that a database would be too heavy to manipulate and I start using csv files... I'm feed up to parse files and to retrieve fields and to update it, etc... so I search a bit and find sqlite, it could solve many of my repetitive operations (most actions is reading data and update data).
In order to learn the way it should I progress by step, first step for me is textbox filling, and I'm ever stuck...
My first and simple goal is to fill the textbox1 text propertie with the result of a query...
I have a one line table called MAIN, in a database named MRIS, and I want to grab the value in a column named YEAR.
here is my "bad" really not working code...
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SQLite;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
SQLiteConnection ObjConnection = new SQLiteConnection("Data Source=Data/MRIS;");
SQLiteCommand ObjCommand = new SQLiteCommand("SELECT * FROM MAIN", ObjConnection);
ObjCommand.CommandType = CommandType.Text;
SQLiteDataAdapter ObjDataAdapter = new SQLiteDataAdapter(ObjCommand);
DataSet dataSet = new DataSet();
textBox1.Text = ??????????????????? ==> I don't know what to do or I the code above is right or too heavy...
}
}
}
If any of you have some time to write a new howto (another ideas... "fill a combox with select query result" ;-)).
Thanks from Paris.