Create Database on Visual Studio 2012




About this tutorial:

Video duration: 18:23
This video explain how to create a new database on Visual Studio 2012 and how to add a table on this local database.

Solve how to add an Arabic text on database

Post Author: OfficeTutes.com

Apple lover, ICT and LEAN consultant, MS Office lecturer My other website with video tutorials - Tutorials, guides and news for iPhones and iPads

13 thoughts on “Create Database on Visual Studio 2012

    ganesh sharma

    (December 3, 2018 - 2:40 pm)

    Great!!!

    Islam El Safy

    (December 3, 2018 - 2:40 pm)

    Awesome video,
    I write that :
                SqlConnection cn = new SqlConnection(global::DataBaseTest.Properties.Settings.Default.Database1ConnectionString);
                try
                {
                    string sql = "INSERT INTO Students (Student_Id,Student_Name) values("+txtID.Text+",'"+txtName.Text+"')";
                    SqlCommand exesql = new SqlCommand(sql,cn);
                    cn.Open();
                    exesql.ExecuteNonQuery();

                    MessageBox.Show("Add new recording is Done !!", "message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.studentsTableAdapter.Fill(this.database1DataSet.Students);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                finally
                {
                    cn.Close();
                }
            }

            private void btnRef_Click(object sender, EventArgs e)
            {
                this.studentsTableAdapter.Fill(this.database1DataSet.Students);
            }
        }
    }

    when I click Add, this message appear "Invalid value for key 'attachdbfilename'." for this line "SqlConnection cn = new SqlConnection(global::DataBaseTest.Properties.Settings.Default.Database1ConnectionString);"  
    what can I do?

    MZSlip

    (December 3, 2018 - 2:40 pm)

    Thank you so much for taking the time to make this!  I found it very helpful!

    Darkizer

    (December 3, 2018 - 2:40 pm)

    i already do this =

     SqlConnection cn = new SqlConnection(global::DataBaseTest.Properties.Settings.Default.Database1ConnectionString);
                try
                {
                
           string sql = "INSERT INTO Students (Student_Id,StudenName) values (" + textID.Text + "," + textName.Text + ")";
                    SqlCommand exesql = new SqlCommand();
                    cn.Open();
                  

                    exesql.ExecuteNonQuery();

                    MessageBox.Show("Add new Records Done !!","Message",MessageBoxButtons.OK,MessageBoxIcon.Information);
                    this.studentsTableAdapter.Fill(this.database1DataSet.Students);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                finally
                {
                    cn.Close();
                }

    but when i click update. it show "Executenonquery connection property has not been initialized." . can you explain it ?

    esteban hernandez

    (December 3, 2018 - 2:40 pm)

    how can I contact you, I need to conect a database and I need some help

    WSR Michael

    (December 3, 2018 - 2:40 pm)

    hi, Great video 🙂
    i followed you untill the sql connection line, then got lost.
    i am using vs2010 and could not finish that line.
    can you help
    Thank You

    Ryan Parry

    (December 3, 2018 - 2:40 pm)

    when i try to update my database it says SQL00000 :: The target database schema could not be retrieved. Cannot open database login failed please help

    Ashutosh Bhardwaj

    (December 3, 2018 - 2:40 pm)

    I did exactly what you did…but as soon as i exit the application..the data in the table gets lost!
    I debug the program again and there is no data in the table 

    Rafael Duarte

    (December 3, 2018 - 2:40 pm)

    great video explain very well what i want 😀

    Carlos Morales

    (December 3, 2018 - 2:40 pm)

    exactly what I was looking for. Thank you. Make more.

    Panagiotis Gnafakis

    (December 3, 2018 - 2:40 pm)

    Great video, Thanks

    Bakkor Mohammed

    (December 3, 2018 - 2:40 pm)

    مشكووور يا غالي ما قصرت درس مفيد جدا ومختصر ..~>

    sarvesh mundra

    (December 3, 2018 - 2:40 pm)

    Hey.. this was great for any new person to learn.. i really struggled to find a good link.. u got it man.. keep it up 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *