Imports System.Data
Imports System.Data.SqlClient

Public Class Form2
Dim myconnection As SqlConnection
Dim mycommand As SqlCommand
Dim dr As SqlDataReader
Dim dr1 As SqlDataReader
Dim ra As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
myconnection = New SqlConnection("server=Pakistan;Initial Catalog=Mumtaz;database=Mumtaz")


myconnection.Open()
mycommand = New SqlCommand("insert into temp([name],[datep]) values ('" & TextBox1.Text & "','" & TextBox2.Text & "')", myconnection)
mycommand.ExecuteNonQuery()
'MessageBox.Show("New Row Inserted" & ra)
myconnection.Close()
End Sub
End Class

i am using vb.net 2005 and sql server 2000 i want insert data using textboxes 
and when i press add button error comes on myconnection.open() point 
what is going on


Imports System.Data
Imports System.Data.SqlClient

Public Class Form2
    Dim myconnection As SqlConnection
    Dim mycommand As SqlCommand
    Dim dr As SqlDataReader
    Dim dr1 As SqlDataReader
    Dim ra As Integer
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        myconnection = New SqlConnection("server=Pakistan;Initial Catalog=Mumtaz;database=Mumtaz")


        myconnection.Open()
        mycommand = New SqlCommand("insert into temp([name],[datep]) values ('" & TextBox1.Text & "','" & TextBox2.Text & "')", myconnection)
        mycommand.ExecuteNonQuery()
        'MessageBox.Show("New Row Inserted" & ra)
        myconnection.Close()
    End Sub
End Class

The problem is in your connection statement. Your specifying the database twice, each a different way and your not specifying the security.

in the 16th line u should use
myconnection = New SqlConnection("server=Pakistan;server=Mumtaz;integrated security= true")
'if u use a password and username to your database u should use
'myconnection = New SqlConnection("server=Pakistan;server=Mumtaz;user=username;password=password")
'here use ur username and password insted of username and password