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.
Any help will be greatly appreciated.
Code:
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")
Last edited by a moderator: