7H3PRO Posted February 8, 2013 Report Share Posted February 8, 2013 Am codu asta:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.IO;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows.Forms;using Finisar.SQLite;namespace WindowsFormsApplication1{ public partial class Form1 : Form { private SQLiteConnection sql_con; private SQLiteCommand sql_cmd; private DataSet DS = new DataSet(); private DataTable DT = new DataTable(); private void SetConnection() { sql_con = new SQLiteConnection("Data Source=data;Version=3;New=True;Compress=True;"); } private void ExecuteQuery(string txtQuery) { SetConnection(); sql_con.Open(); sql_cmd = sql_con.CreateCommand(); sql_cmd.CommandText = txtQuery; sql_cmd.ExecuteNonQuery(); sql_con.Close(); } public Form1() { InitializeComponent(); } private void btnRegister_Click(object sender, EventArgs e) { string txtSQLQuery = "INSERT INTO users VALUES ('"+tbMail.Text+"', '"+tbNick.Text+"', '"+tbPwd.Text+"')"; ExecuteQuery(txtSQLQuery); } private void Form1_Load(object sender, EventArgs e) { if (File.Exists("data")) { } else { string txtSQLQuery = "CREATE TABLE users (email VARCHAR(64), nickname VARCHAR(16), password VARCHAR(16));"; ExecuteQuery(txtSQLQuery); } } }}Povestea merge bine pana la partea cu INSERT INTO, unde zice no such table: users, de ce face asta? Quote Link to comment Share on other sites More sharing options...
hades Posted February 8, 2013 Report Share Posted February 8, 2013 Nu am folosit C# niciodata, dar nu ar trebui sa selectezi si baza de date, undeva? Quote Link to comment Share on other sites More sharing options...
SticKyWoX Posted February 8, 2013 Report Share Posted February 8, 2013 Nu am folosit C# niciodata, dar nu ar trebui sa selectezi si baza de date, undeva?La asta m-am gandit si eu, dar am banuit ca a sters datele de la db, printre care era si baza de date selectata.foloseste %nume.db%.users Quote Link to comment Share on other sites More sharing options...
cristynel Posted February 8, 2013 Report Share Posted February 8, 2013 Incearca urmatoarea sintaxa:string txtSQLQuery = "INSERT INTO users(email,nickname,password) VALUES ('"+tbMail.Text+"', '"+tbNick.Text+"', '"+tbPwd.Text+"')"; Quote Link to comment Share on other sites More sharing options...
7H3PRO Posted February 9, 2013 Author Report Share Posted February 9, 2013 Gata i-am dat de cap, si baza de date este fisierul in sine "data" doar ca i-am scos terminatia. Quote Link to comment Share on other sites More sharing options...