SPRASAD Posted March 14, 2003 Posted March 14, 2003 (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 March 14, 2003 by Robby Quote
Moderators Robby Posted March 14, 2003 Moderators Posted March 14, 2003 The code looks fine, are you sure about the contents of your Connection String? Quote Visit...Bassic Software
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.