title: trying to add data in SQL Server 2005 database in vb.net
body: <p>Could someone please help me in here, I'm just a beginner who want to learn on manipulating SQL Server data using vb.net. I have already experienced manipulating data in ms access. So I just recycled the code that I used in here. But unfortunately I got this error:</p>
  
  <pre><code>Object reference not set to an instance of an object.
  </code></pre>
  
  <p>And another problem is that, I'm not really sure if what I have inputted in the SqlConnection matches what is in SQL Server. Here is a screen shot of sql server management studio express:</p>
  
  <p>[<a href="http://screencast.com/t/Y2Q0NWRhYTA][1]" rel="nofollow noreferrer">http://screencast.com/t/Y2Q0NWRhYTA][1]</a></p>
  
  <pre><code>Imports system.data.sqlclient
  
  'declarations
   Dim idnum As String
      Dim lname As String
      Dim fname As String
      Dim skul As String
  
      Dim sqlcon As SqlConnection
      Dim sqlcom As SqlCommand  
  
  idnum = TextBox1.Text
          lname = TextBox2.Text
          fname = TextBox3.Text
          skul = TextBox4.Text
  
  sqlcon.open
  
              sqlcon = New SqlConnection("Data Source=SENBONZAKURA\SQLEXPRESS;Initial Catalog=testing;User ID=SenbonZakura/Rew;")
              sqlcom = New SqlCommand("select * from [student]", sqlcon)
  
              Dim strsql As String = "insert into [student]([ID], [LASTNAME], [FIRSTNAME], [SCHOOL]) values('" + idnum + "','" + lname + "','" + fname + "','" + skul + "')"
  
  
              sqlcom.ExecuteNonQuery()
  </code></pre>