1

How do it? I spent 20 minutes searching it, but finded how to query a command, but is buggly. I use System.Data.SQLite

try 
{ 

    SQLiteConnection cnn = new SQLiteConnection(label2.Text); 
    cnn.Open();//Error is here! 
    SQLiteCommand cmd = cnn.CreateCommand(); 
    cmd.CommandText = textBox1.Text; 
    cmd.ExecuteNonQuery(); MessageBox.Show("Query is good!"); 
    cnn.Close();

} 
catch (SQLiteException ee) 
{ 
    MessageBox.Show(ee.Message);
}
3
  • Try Catch Statement, show some code please. Commented Feb 23, 2013 at 19:44
  • try { SQLiteConnection cnn = new SQLiteConnection(label2.Text); cnn.Open();//Error is here! SQLiteCommand cmd = cnn.CreateCommand(); cmd.CommandText = textBox1.Text; cmd.ExecuteNonQuery(); MessageBox.Show("Query is good!"); cnn.Close(); } catch (SQLiteException ee) { MessageBox.Show(ee.Message); } Commented Feb 23, 2013 at 19:52
  • ERROR: Invalid ConnectionString format for part "D:\myserver\resources\default\scriptfiles\server.db", no equal sign found but, i dont know, if try function :D Commented Feb 23, 2013 at 19:53

2 Answers 2

2

You probably forgot the data source before your path

@"data source=C:\mydb.db"
Sign up to request clarification or add additional context in comments.

Comments

0

You just need to use the prefix @ character to rid issues of special characters, or you can just add escape caharacters :-

@"D:\myserver\resources\default\scriptfiles\server.db"



"D:\\myserver\\resources\\default\\scriptfiles\\server.db"

1 Comment

But fixed! I must add before a url this: "URI=File:"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.