Click here to Skip to main content
15,887,027 members
Home / Discussions / C#
   

C#

 
AnswerRe: convert code form C# 2008 to C# 2005 have DataClass ? Pin
Member 245846723-Apr-15 18:10
Member 245846723-Apr-15 18:10 
Questiontreeview node selection always return first Node of Tree, instead of selected one Pin
anupam_unique22-Apr-15 7:00
anupam_unique22-Apr-15 7:00 
QuestionHow to spoof ip in webBrowser control Pin
hapiten22-Apr-15 5:52
hapiten22-Apr-15 5:52 
AnswerRe: How to change ip in webBrowser control Pin
Richard MacCutchan22-Apr-15 6:35
mveRichard MacCutchan22-Apr-15 6:35 
GeneralRe: How to change ip in webBrowser control Pin
hapiten22-Apr-15 6:55
hapiten22-Apr-15 6:55 
GeneralRe: How to change ip in webBrowser control Pin
Richard MacCutchan22-Apr-15 7:03
mveRichard MacCutchan22-Apr-15 7:03 
AnswerRe: How to spoof ip in webBrowser control Pin
Eddy Vluggen22-Apr-15 9:01
professionalEddy Vluggen22-Apr-15 9:01 
QuestionWinForm Database is locked SQLite Pin
DPaul199422-Apr-15 4:20
DPaul199422-Apr-15 4:20 
I want to update a column from table but I receive: database is locked twice. The error accours only when I call updateIndex() function. Why? This is the complete code:
Load function:
C#
private void MediuInvatare_Load(object sender, EventArgs e)
        {
            using (Conexiune.getConnection())
            {
                string select = "SELECT * FROM questions WHERE id = indexrow LIMIT 1";
                using (SQLiteCommand cmd = new SQLiteCommand(select, Conexiune.getConnection()))
                {
                    cmd.CommandType = CommandType.Text;
                    using (SQLiteDataReader rdra = cmd.ExecuteReader(CommandBehavior.CloseConnection))
                    {
                        try
                        {
                            while (rdra.Read())
                            {
                                textBox1.Text = rdra["question"].ToString();
                                idintrebare = Convert.ToInt32(rdra["id"]);
                            }
                            rdra.Close();
                        }
                        catch (InvalidOperationException ex)
                        {
                            MessageBox.Show(ex.Message);
                        }
                    }
                }
            }
        }

Function where is the problem (I guess):
C#
private void updateIndex()
        {
            string update = "UPDATE questions SET indexrow='" + idintrebare + "' WHERE id='" + idintrebare + "'";
            SQLiteCommand comp = new SQLiteCommand(update, Conexiune.getConnection());
            comp.CommandType = CommandType.Text;
            comp.Parameters.AddWithValue(idintrebare.ToString(), idintrebare);
            SQLiteDataAdapter da = new SQLiteDataAdapter(comp);
            DataTable dt = new DataTable();
            da.Fill(dt);
        }

Button where updateIndex() is called:
C#
private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                updateIndex();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

AnswerRe: WinForm Database is locked SQLite Pin
Simon_Whale22-Apr-15 4:29
Simon_Whale22-Apr-15 4:29 
AnswerRe: WinForm Database is locked SQLite Pin
Sascha Lefèvre22-Apr-15 4:42
professionalSascha Lefèvre22-Apr-15 4:42 
GeneralRe: WinForm Database is locked SQLite Pin
DPaul199422-Apr-15 5:34
DPaul199422-Apr-15 5:34 
GeneralRe: WinForm Database is locked SQLite Pin
Sascha Lefèvre22-Apr-15 5:46
professionalSascha Lefèvre22-Apr-15 5:46 
GeneralRe: WinForm Database is locked SQLite Pin
DPaul199422-Apr-15 8:28
DPaul199422-Apr-15 8:28 
GeneralRe: WinForm Database is locked SQLite Pin
Sascha Lefèvre22-Apr-15 8:38
professionalSascha Lefèvre22-Apr-15 8:38 
GeneralRe: WinForm Database is locked SQLite Pin
DPaul199422-Apr-15 9:10
DPaul199422-Apr-15 9:10 
GeneralRe: WinForm Database is locked SQLite Pin
Sascha Lefèvre22-Apr-15 9:24
professionalSascha Lefèvre22-Apr-15 9:24 
GeneralRe: WinForm Database is locked SQLite Pin
DPaul199422-Apr-15 9:44
DPaul199422-Apr-15 9:44 
GeneralRe: WinForm Database is locked SQLite Pin
DPaul199422-Apr-15 9:53
DPaul199422-Apr-15 9:53 
GeneralRe: WinForm Database is locked SQLite Pin
Sascha Lefèvre22-Apr-15 9:58
professionalSascha Lefèvre22-Apr-15 9:58 
GeneralRe: WinForm Database is locked SQLite Pin
DPaul199422-Apr-15 9:59
DPaul199422-Apr-15 9:59 
GeneralRe: WinForm Database is locked SQLite Pin
DPaul199422-Apr-15 9:57
DPaul199422-Apr-15 9:57 
GeneralRe: WinForm Database is locked SQLite Pin
Sascha Lefèvre22-Apr-15 10:04
professionalSascha Lefèvre22-Apr-15 10:04 
GeneralRe: WinForm Database is locked SQLite Pin
DPaul199422-Apr-15 10:08
DPaul199422-Apr-15 10:08 
GeneralRe: WinForm Database is locked SQLite Pin
Sascha Lefèvre22-Apr-15 10:10
professionalSascha Lefèvre22-Apr-15 10:10 
SuggestionRe: WinForm Database is locked SQLite Pin
Richard Deeming22-Apr-15 4:43
mveRichard Deeming22-Apr-15 4:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.