Jump to content
Xtreme .Net Talk

Recommended Posts

Posted (edited)

I have the following Code which does no seem to work. I got most of this code from help files and samples where it seems to work fine.

 

Any help will be greatly appreciated.

       Dim LangRow As DataRow
       Dim nCount As Long
       Dim cnSQL As SqlConnection
       Dim cmSQL As SqlCommand
       Dim drSQL As SqlDataReader
       Dim strSQL As String

       Try

           strSQL = "SELECT LangRef.LangCode, Langref.LangStr FROM LangRef"

           cnSQL = New SqlConnection(ConnectionString)
           cnSQL.Open()

           cmSQL = New SqlCommand(strSQL, cnSQL)
           drSQL = cmSQL.ExecuteReader()
           nCount = 0

           Do While drSQL.Read()
               LangRow = tNewLang.NewRow()
               LangRow(0) = drSQL.Item("LangCode")
               LangRow(1) = drSQL.Item("LangStr")
               tNewLang.Rows.Add(LangRow)
               nCount = nCount + 1
               lblCount.Text = "Number of Records Imported From Language File: " & nCount
           Loop

           ' Close and Clean up objects
           drSQL.Close()
           cnSQL.Close()
           cmSQL.Dispose()
           cnSQL.Dispose()
           MsgBox("Import Complete", MsgBoxStyle.OKOnly, "Import Data")

Edited by Robby

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...