Ok I am very new to VB. I have a VB program which was coded originaly in XP. After doing an update on it to be workable on Win7, I faced with some issues. The major issue that I couldn't fix was the DataReader problem. The cmdLink connects to database and Selects the info that I asked but when I'm asking to read in drLink, I get rows=false. It the exact same code. The XP code works fine but the updated one doesn't. Here is my code.
Code:Private Sub LaunchSpecView(ByVal columns As String) Dim cn As New OleDb.OleDbConnection(connString) cn.Open() Dim CommandLine As String = "" 'set dataReader and Command Dim cmdLink As New OleDb.OleDbCommand("Select Distinct a.* from ReplaceableAssemblies a, Files b, RefFileTable c Where a.[Ref Des] = '" & Me.RefDes & "' AND c.RepAssemRec = a.RecNo AND b.RecNo = c.FileRec AND b.FileName = '" & My.Forms.MainForm.lblFileName.Text + "'", MainForm.cn) Dim drLink As OleDb.OleDbDataReader = cmdLink.ExecuteReader Here is my problem 'check that file exists (I will see error message) If Not System.IO.File.Exists(Directory.GetParent(Directory.GetParent(Application.StartupPath).ToString()).ToString() & "\bin\specview.exe") Then MessageBox.Show("Check that path is correct. " & vbCrLf & _ "Check that GlobalHawk.exe is as follows ....'IETM\Applications\p2p\GlobalHawk.exe'" & _ vbCrLf & _ "And/Or make sure that specview.exe is in .....IETM\bin\specview.exe", "Error", MessageBoxButtons.OK, _ MessageBoxIcon.Error) drLink.Close() cn.Close() Exit Sub End If 'loop through and grab file Do While drLink.Read If Not drLink(columns).ToString().ToLower().Equals("n/a") Then CommandLine += "," & drLink(columns) Loop 'close connection drLink.Close() cn.Close() If CommandLine.Length > 0 Then Process.Start(Directory.GetParent(Directory.GetParent(Application.StartupPath).ToString()).ToString() & "\bin\specview.exe", " -loaddm " & CommandLine.Substring(1)) MessageBox.Show(CommandLine.Substring(1)) Me.Close() End If End Sub




Reply With Quote
