Click here to Skip to main content
15,891,184 members
Home / Discussions / C#
   

C#

 
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 
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 
1) For Insert-, Update- and Delete-Statements you should use the ExecuteNonQuery()-method of the Command-object.
2) Though you initialized an Sql-Parameter and added it to the Command-object, you didn't adjust your Sql-Statement accordingly and you used the value of your variable idintrebare as the name for the parameter.
3) As CommandType.Text is the default, you don't have to explicitly set it.
4) Use disposable objects (the Connection and Command here) in a using-Block. See this Article: IDisposable: What Your Mother Never Told You About Resource Deallocation[^]
5) idintrebare appears to be a class-member. I would suggest you call updateIndex() with idintrebare as an argument instead. As I don't know the type of it, I'll use int here, please adjust that if neccessary.

This should work:
C#
private void updateIndex(int id)
{
    string update = "UPDATE questions SET indexrow=@idintrebare WHERE id=@idintrebare;";
    using (var connection = Conexiune.getConnection())
    using (SQLiteCommand cmd = new SQLiteCommand(update, connection))
    {
        connection.Open();
        cmd.Parameters.AddWithValue("@idintrebare", id);
        cmd.ExecuteNonQuery();
    }
}

If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson

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 
GeneralRe: WinForm Database is locked SQLite Pin
DPaul199422-Apr-15 5:27
DPaul199422-Apr-15 5:27 
QuestionHow to register the library flash for C# 2005 ? Pin
Member 245846721-Apr-15 17:53
Member 245846721-Apr-15 17:53 

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.