Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Which database is Suggested for c# wpf applications????

$
0
0

I developed an application using c# wpf and sql ce in visual studio and i stored some data in sql ce. After completion of the application i installed it in another pc and my application is not running when i'm trying to store the values in database.

Is there any need to install sql ce in client system? 

in that case tell me the programming language  and in-build database which doesn't require any other applications in the client system.

or

my code is wrong??? this is the some part of code that i used in my app.

                                                   

 private void Button_Click_2(object sender, RoutedEventArgs e)
        {
            String st_name = stname.Text;
            String st_rno = strno.Text;
            String st_sex = stsex.Text;
            String st_class = stclass.Text;
            String st_add = stadd.Text;


            SqlCeConnection connection = new SqlCeConnection(@"Data Source=|DataDirectory|\Database1.sdf");
            connection.Open();
            //SqlCeCommand command = new SqlCeCommand("SELECT * FROM StData",connection);

           using(  SqlCeCommand cmd = new SqlCeCommand ("INSERT INTO StData(Name,RNo,Sex,Class,Address) VALUES (@val1, @val2, @val3, @val4, @val5)",connection))
           {
                cmd.Parameters.AddWithValue("@Val1", st_name);
                cmd.Parameters.AddWithValue("@Val2", st_rno);
                cmd.Parameters.AddWithValue("@Val3", st_sex);
                cmd.Parameters.AddWithValue("@Val4", st_class);
                cmd.Parameters.AddWithValue("@Val5", st_add);
                cmd.CommandType = System.Data.CommandType.Text;
                cmd.ExecuteNonQuery();
                MessageBox.Show("Successfully Inserted");

             }


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>