1337.Ibrahim Posted August 26, 2017 Share Posted August 26, 2017 SqlConnection cn = new SqlConnection(@"Data source=Talis-PC\Talis; Initial Catalog=MyDataBase; Integrated Security=true;"); Error : ENC0041 Modifying the initializer of 'field' in a partial type will prevent the debug session from continuing. Link to comment
1337.Ibrahim Posted August 27, 2017 Author Share Posted August 27, 2017 تم حل المشكلة اللي فوق ^ مشكلة ثانية SqlConnection cn = new SqlConnection(@"Server=.\Talis; DataBase=MyDataBase; Integrated Security=true;"); SqlCommand cmd; SqlDataReader dr; public Form1() { InitializeComponent(); cmd = new SqlCommand("Selcet Title From Table_Books", cn); cn.Open(); dr = cmd.ExecuteReader(); while (dr.Read()) { listBox1.Items.Add(dr["Title"].ToString()); } dr.Close(); cn.Close(); 9في سطر System.Data.SqlClient.SqlException: 'Incorrect syntax near the keyword 'From'.' @iMr.WiFi..! @Master_MTA @#,+( _xiRoc[K]; > @Abdul KariM Link to comment
Master_MTA Posted August 27, 2017 Share Posted August 27, 2017 3 minutes ago, Talis said: تم حل المشكلة اللي فوق ^ مشكلة ثانية SqlConnection cn = new SqlConnection(@"Server=.\Talis; DataBase=MyDataBase; Integrated Security=true;"); SqlCommand cmd; SqlDataReader dr; public Form1() { InitializeComponent(); cmd = new SqlCommand("Selcet Title From Table_Books", cn); cn.Open(); dr = cmd.ExecuteReader(); while (dr.Read()) { listBox1.Items.Add(dr["Title"].ToString()); } dr.Close(); cn.Close(); 9في سطر System.Data.SqlClient.SqlException: 'Incorrect syntax near the keyword 'From'.' @iMr.WiFi..! @Master_MTA @#,+( _xiRoc[K]; > @Abdul KariM اذكر اللغه اللي مستخدمه هل هي c# ? java? وش اللغه Link to comment
1337.Ibrahim Posted August 27, 2017 Author Share Posted August 27, 2017 43 minutes ago, Master_MTA said: اذكر اللغه اللي مستخدمه هل هي c# ? java? وش اللغه C# Link to comment
Master_MTA Posted August 27, 2017 Share Posted August 27, 2017 37 minutes ago, Talis said: C# الخطا اللي معطينا اياه ماله علاقه بالكود على حسب ظني؟ Link to comment
1337.Ibrahim Posted August 27, 2017 Author Share Posted August 27, 2017 25 minutes ago, Master_MTA said: الخطا اللي معطينا اياه ماله علاقه بالكود على حسب ظني؟ مدري والله ، اذا جيت اسوي ستارت يعطيني خطا في سطر 9 Link to comment
Master_MTA Posted August 27, 2017 Share Posted August 27, 2017 10 minutes ago, Talis said: مدري والله ، اذا جيت اسوي ستارت يعطيني خطا في سطر 9 cn.Open();؟ Link to comment
1337.Ibrahim Posted August 27, 2017 Author Share Posted August 27, 2017 47 minutes ago, Master_MTA said: cn.Open();؟ سطر 10 * اعذرني Link to comment
Master_MTA Posted August 27, 2017 Share Posted August 27, 2017 27 minutes ago, Talis said: سطر 10 * اعذرني يتعدل الى cmd = new SqlCommand(cn,"Selcet Title From Table_Books"); Link to comment
1337.Ibrahim Posted August 27, 2017 Author Share Posted August 27, 2017 4 minutes ago, Master_MTA said: يتعدل الى cmd = new SqlCommand(cn,"Selcet Title From Table_Books"); http://imgur.com/a/nap2u Link to comment
Master_MTA Posted August 27, 2017 Share Posted August 27, 2017 1 minute ago, Talis said: http://imgur.com/a/nap2u hmmm حسبت مثل لوا المهم جرب كذا cmd = new SqlCommand("Selcet Title From Table_Books", new SqlConnection(@"Server=.\Talis; DataBase=MyDataBase; Integrated Security=true;")); 1 Link to comment
1337.Ibrahim Posted August 27, 2017 Author Share Posted August 27, 2017 12 minutes ago, #,+( _xiRoc[K]; > said: Selcet = Select الله يرزقك الجنة ياخي من امس وانا احاول خطأ بسيط خرب البرنامج بالكامل هههههه الله يعطيكم العافية 1 Link to comment
1337.Ibrahim Posted August 27, 2017 Author Share Posted August 27, 2017 try { cmd = new SqlCommand("Insert into Table_Books(ID, Title, Auther, Date, Pages) values ('" + textID.Text + "', '" + textTitle.Text + "', '" + textAuther.Text + "', '" + DataTimef.Value + "'. '" + Textofpages.Text + "')", cn); cn.Open(); cmd.BeginExecuteNonQuery(); MessageBox.Show("added successfully !", "add", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (SqlException ex) { MessageBox.Show("some errors in your code " + ex.Message); } finally { cn.Close(); } ليه مايضيف شي بالجدول؟ مافي اي خطأ في الليست + Link to comment
1337.Ibrahim Posted August 27, 2017 Author Share Posted August 27, 2017 تم حل المشكلة ! Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now