Hye, I had a difficulties to insert the data in vb.net into sql, I had try few times, but it seems the data can't be read in the database, I hope anyone could help me :(

'decare connections to server here and commands


  Dim dc As SqlCommand = New SqlCommand

   With dc
    .Connection = con 'con is assumed to be your declared connection string 
    .CommandText = "INSERT INTO tablename" & _
      "(column1, column2)" & _
          "VALUES ( @value1, @value2)"
    .Parameters.AddWithValue("@value1", TextBox1.Text)
    .Parameters.AddWithValue("@Value2", TextBox2.Text)

   End With

	con.Open()

     Try
         objcommand.ExecuteNonQuery()
  	       Catch sqlexceptionerr As SqlException
          MessageBox.Show(sqlexceptionerr.Message)
    End Try
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.