Click here to Skip to main content
16,005,125 members

Comments by rogelsab (Top 2 by date)

rogelsab 22-Jul-13 4:44am View    
Hey midnight_,

Where should I place that query? In my SQLite GUI or in WPF C#?

I think that's only for the SQLite GUI.
Also, when I tried it, it returns null value since I haven't entered any data yet.
That query would only return something during the time that I added a new data, when the application closes, it returns to null.
rogelsab 22-Jul-13 4:40am View    
Hey Naz_Firdouse,

Do you mean like this?

private void Window_Loaded(object sender, RoutedEventArgs e)
{
SQLiteConnection sqliteCon = new SQLiteConnection(dbConnectionString);
try
{
sqliteCon.Open();
SQLiteCommand createCommand = new SQLiteCommand("select max(memberID) from ieeeuesbmembers", sqliteCon);
SQLiteDataReader dataReader = createCommand.ExecuteReader();
memID = Convert.ToInt32(dataReader["memberID"]);
tbxMemID.Text = Convert.ToString(memID);
sqliteCon.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

It shows another error:

Index was outside the bounds of the array.

Thanks!