i have this insert code that is refusing to work it is giving me error 26: something to do with the network or connection.
i am using sql express 2005 and vb.net 2008 any help will be greatly appreciated

]
Dim MyConnection As SqlConnection

        Dim sqlstring As String = "INSERT INTO items_table (item)  VALUES ('" & Me.txtItem.Text & "')"
        'Dim data_base As String = " C:\Documents and Settings\admin\Desktop\OCSWalkthrough\OCSWalkthrough\App_Data\Testing_DB.sdf"
        Dim data_base As String = " C:\vb2008\Visual Studio 2008\Projects\morevariables\morevariables\App_Data\test_db.mdf;Integrated Security=True;User Instance=True"

        MyConnection = New SqlConnection("Data Source=" & data_base)

        Dim concom As SqlCommand = MyConnection.CreateCommand()


        MyConnection.Open()

        Dim cmnd As SqlCommand = New SqlCommand(sqlstring, MyConnection)

        cmnd.ExecuteNonQuery()        ' Execute the command here

        'and then read
        Dim myreader As SqlDataReader

        myreader = cmnd.ExecuteReader

        MyConnection.Close()

Wrong connection string

MyConnection = New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFileName=" & data_base)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.