I'm developing an ASP.NET application with VB, and using SQL Command and Connection in VB to grab the data for the page. I have both portions initialized as such:
And so on, like that. I left out the eventQuery, because that one works fine. The travel query and event query also have the same connection string. The program has the event query executes and then if one of the values, RdwyID returned fits within a certain range, travelQuery executes.I set RdwyID to 187 within the code to force it to pull and post the travel times, and when I try running it it crashes saying that there are no values. Here's the exact code I use. I do things in the exact same way with eventQuery where it works fine. I am making sure to open and close the connection properly. Time is properly declared as an array of objects.
The TripNum I'm checking the query against is a constant value inside the database with a data type of text.
Dim rdwyID As Integer
'rdwyID = events(9) - where the value is pulled from usually'
rdwyID = 187
[code]....
Edit: Made the changes like you said, and the if statement for execute reader is evaluating to false. I know nothing about working with the reader, what sort of conditions would make it fail? Thanks a bunch.
Edit 2: Checking the Count for matching the condition returned zero, and checking it straight-up returned 15. Thanks so much. Time to figure out why on Earth it's not matching...
I want to launch a application called Foxit Reader pdf Reader .I know System.Diagnostics.Process.Start(path) can do it but . Requirements are Foxit Reader should be installed on machine.Now if it is installed how to serarch for the path of its Executable to provide the parameter as I can not hardcode the path for different machines.
I am having an issue with both Adobe Reader and FoxIt Reader when trying to print a PDF document. Both issues are different but a solution to either one will allow me to fix my issue.The issue I am having with Adobe Reader when trying to print using the following code is that it will not print it to the network printer I specify but just the default printer.
Dim AdobeReader As New Process AdobeReader.StartInfo.CreateNoWindow = False AdobeReader.StartInfo.Verb = "print"
namespace of "system.runtime.caching" does not exist but in object explorer and microsof exist.i use microsoft visual studio 2010 and .net framework 4.0.i also cant use this name space(System.IO.MemoryMappedFiles & System.Runtime.Caching.MemoryCache)
any body know what is the problem. i want my program after doing something (opening a file or any thing that can do something my program use more memory.)use memory like startup run.
I have Requests for VB(2005) very very important for my selly project!i need a button that determine if file exist and if that file exist then show a messagebox!and if not show messagebox!.
how would I accomplish saving a large piece of data, using the Stream Reader for the Line-by-Line, while keeping the carriage return line feeds in there?
Using VB.Net and Sql Server I want to check the user Entry Value.The User is entering the code in the textbox, before saving to the table, i want to check whethere code is already exist in the table or not.
Tried Code
cmd = New SqlCommand("Select code from table where code = '" & textbox1.Text & "' ", Con) dr = cmd.ExecuteReader() While dr.Read() End While
If value is exist, then message to the user "Already Exist" other wise save to the table.
i am new to VB.net. just want to check an id number in my textbox if its aldready existed in my database. this is my condition: if textbox1.text = ds.tables("employees").row(0).item("id") then msgbox("ID already exist") end if
I feel quite silly posting this as I know my way around C++ decently and am writing an application in VB however I am getting quite frustrated with this problem.
Dim FileNo As Integer FileNo = FreeFile() Dim FILE_NAME As String = "C: est.txt"
[Code].....
When executing the above code it says at the FileOpen operation that the document does not exist or the relative path may not be right... I have looked in many place over the internet and even used the same examples from the Microsoft website however I get the same error.
I am currently rewriting a VBA XML reader to a VB.net version for a project. I have the following code in VBA:
Dim XML_Doc As Object: Set XML_Doc = CreateObject("MSXML2.DOMDocument") Dim XML_Detail As New ADODB.Recordset: XML_Detail.ActiveConnection = "Provider=MSDAOSP; Data Source=MSXML2.DSOControl.2.6;"
I was told that I should be able to use almost the exact code in my VB.Net version but I am running into some problems. I added as a reference to the VB.net project the Microsoft ActiveX 2.8 so I can use the ADODB.
The code in VB.Net is
Dim XmlDoc As Object : XmlDoc = CreateObject("MSXML2.DOMDocument") Dim XmlDetail As New ADODB.Recordset : XmlDetail.ActiveConnection = "Provider=MSDAOSP; Data Source=MSXML2.DSOControl.2.6;"
When running the application it gets to the XmlDetail and throws the following error:System.Runtime.InteropServices.COMException was unhandled. Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
I am attempting to read specific lines of GIANT text files (> 150 MB) with hundreds of thousands of lines. The files are contained on an FTP site. I can successfully open the files using FTPwebrequest and streamreader but to get to a specific line using streamreader, you have to read every line before it. Obviously this takes a lot of time when you need to get to the millionth line.
A much faster way, I think, would be to use filestream and the filestream.position function. However, I'm not sure how to open a file as a filestream from FTP. I have tried:
Dim ftpaddress as string = "ftp://####@ftp.textfile.asc+" Dim fileStream1 As New FileStream(ftpaddress, IO.FileMode.Open, IO.FileAccess.Read)
I've been developing a simple virus scanner and it works by reading the hex code of a file and comparing it to signatures from a database. Anyway, the only thing slowing it down is how it reads the hex. This is the hex reading part of my code so far:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LoadFile.Click Dim ArrayHold() As Byte Dim Index As Integer = 0 Dim Str As New StringBuilder
I'm looking forward to make a system using a BCode Reader. Like the way when a book has a correspond barcode and when it scan by a BCode reader the correspond info on the book will be showed in he system. So how to code the BCode reader and how it will determine the barcode of a book or what ever items that has a barcode?
How do I really use data reader in vb.net. I'm using odbc to connect mysql and vb.net. Function I declared on a module:
Public Function form2search(ByVal drugname As String) As OdbcDataReader cmd.CommandText = "SELECT * FROM drug WHERE Drug_name LIKE'%" & drugname & "' " Return cmd.ExecuteReader End Function [Code] .....
I see a result, but it only loads the first item on the database. I've put this code in the text_changed event. What's the proper way of doing this? And what's wrong with the 2nd code, why is it only loading the first data. As you can see the con is the module where I declared the function. Then I created an object of it in the form.
Using VB 2010 on W7 x64 and I'm getting the HID device registered OK but then I never get the WM_INPUT messages. I test it on x32 Vista and same thing... no WM_INPUTs.
In an older program I am now maintaining, a SQL query is issued and the results are fed in to a DataTable and accessed through a DataTableReader.I see lots of lines like:
myInt = CInt(dtr.getvalue(42))
What I want to know is, would this ever differ from:
myInt = dtr.getint32(42)
If there could be a difference, what would trigger it?
it works if all the elements are found (< Message > and < Title >).. but if for example the element "< Title >" is not found I get an error by trying to get the innerText.Is there a way to ignore these errors, I just want to receive an empty value and not any errors.
I'm getting a suprising FileNotFoundException although i'm sure that the file exists.I simply wanted to add Logfiles(IO.FileInfo) as attachments to an email, therefore i tried to check the length of every file to detect if they must be added/zipped.This works fine if these files already exist. But if i've created them in this run, i get above exception when i try to check the length. It's oddly enough that i can write into these "not existing" files(actually FileInfo.Exists returns false) without a problem one line before.
Here is some code...
Creating one of the files in the constructor of a class named Log:
Me.LogFile = New IO.FileInfo(infoLogPath) If Not LogFile.Exists() Then 'tried to use `Using` on the Stream but that doesn't change anything'