i have code
Protected Sub btn_submitt_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn_submitt.Click
Try
If (ddl_Country.SelectedItem.Text = "Select Country") Then
Me.Label1.Visible = True
Me.Label1.Text = "Please Select Country"
Else
Me.Label1.Visible = False
Dim n As Int32
Dim connString As String = System.Configuration.ConfigurationManager.ConnectionStrings("containerConnectionString").ConnectionString
Dim con As SqlConnection = New SqlConnection(connString)
con.Open()
Dim str, str1 As String
'**************************
cmd.Parameters.Add("@sal", SqlDbType.NVarChar).Value = Me.DropDownList1.SelectedItem.Text
cmd.Parameters.Add("@Name", SqlDbType.NVarChar).Value = Me.txt_name.Text
cmd.Parameters.Add("@Position", SqlDbType.NVarChar).Value = Me.txt_position.Text
cmd.Parameters.Add("@Companyname", SqlDbType.NVarChar).Value = Me.txt_cname.Text
cmd.Parameters.Add("@Address", SqlDbType.NVarChar).Value = Me.txt_address.Text
cmd.Parameters.Add("@city", SqlDbType.NVarChar).Value = Me.txt_city.Text
cmd.Parameters.Add("@state", SqlDbType.NVarChar).Value = Me.txt_state.Text
cmd.Parameters.Add("@Country", SqlDbType.NVarChar).Value = Me.ddl_Country.SelectedItem.Text
cmd.Parameters.Add("@telephone", SqlDbType.NVarChar).Value = Me.txt_Telephone.Text
cmd.Parameters.Add("@telefax", SqlDbType.NVarChar).Value = Me.txt_telefax.Text
cmd.Parameters.Add("@Email", SqlDbType.NVarChar).Value = Me.txt_email.Text
cmd.Parameters.Add("@webaddress", SqlDbType.NVarChar).Value = Me.txt_webaddress.Text
'cmd.Parameters.Add("@want_visa", SqlDbType.Int ).Value = Me.rd
'cmd.Parameters.Add("@Email", SqlDbType.NVarChar).Value = Me.txt_email.Text
'Create a SqlParameter object to hold the output parameter value
Dim UserIDParam As New SqlParameter("@UserID", SqlDbType.Int)
'IMPORTANT - must set Direction as Output
UserIDParam.Direction = ParameterDirection.Output
'Finally, add the parameter to the Command's Parameters collection
cmd.Parameters.Add(UserIDParam)
cmd = New SqlCommand("User_Insert", con)
cmd.CommandType = CommandType.StoredProcedure
con.Open()
Dim reader As SqlDataReader = cmd.ExecuteReader()
Dim userid As Int32 = Convert.ToInt32(UserIDParam.Value)
' str = "insert into [users]([Sal],[Name],[position] ,[company name],[Address],[city],[state],[country],[telephone],[telefax],[email],[webaddress],[want_visa],[pickDrop] )values ('" & Me.DropDownList1.SelectedItem.Text & "' ,'" & Me.txt_name.Text & "' ,'" & Me.txt_position.Text & "','" & Me.txt_cname.Text & " ','" & Me.txt_address.Text & "' ,'" & Me.txt_city.Text & "','" & Me.txt_state.Text & "','" & Me.ddl_Country.SelectedItem.Text & "', '" & Me.txt_Telephone.Text & "','" & Me.txt_telefax.Text & "' ,'" & Me.txt_email.Text & "' ,'" & Me.txt_webaddress.Text & "', " & Me.rdbtn_wantvisa.SelectedItem.Value & " , " & Me.rdbtn_pickDrop.SelectedItem.Value & ") "
' str1 = "insert into [user_company]([userid],[id] )values () "
End If
Catch ex As Exception
MsgBox(ex.ToString())
End Try
i m getting an error Object reference not set to an instance of an object
End Sub