I would like to break a "SELECT" SQL statement into its logical components. i.e. I would like to create an object like "SelectSqlStatement" which has a property called "Table", "Where", "OrderBy", etc. The reason I want to do it is that I don't want to manipulate a string but rather manipulate an object and serialize it back to a string. Before I write one for .NET, I was wondering if there was one available. I did a search but didn't see anything.
i'm afraid that this is a stupid question, but i must assume that i have programmed VB.Net too long and now can't figure out how to convert this C# null coalescing operator into VB.Net:
I know the IIF-Function but i'm not sure how to use it here and if it gives the correct result(in IIF both expressions are being evaluated). Please help to shed light on the dark.EDIT: if you want to see the source of this: forums.asp.net There you can see a solution that generates a Option Strict On disallows implicit conversions from 'Object' to 'Boolean' compiler exception.
I have a class Customer which contains the property Extensions which in turn contains the property Any. I tried to do: Dim room = If(customer.Extensions.Any.ElementAt(0).InnerText, Nothing) but it threw an error when it did not find an Extension element in the incoming xml. I thought it would return nothing once it saw that the first expression was Nothing. Do I have to do a multiple if statement in this case?
I'm trying to do something similar to what's described here, but with nullable types.
[URL]
int availableUnits = unitsInStock ?? 0;
In VB, it would be this:
Dim availableUnits As Int32 = If(unitsInStock, 0)
However I'm working with db columns, which could be DbNull, and nullable types, which can be Nothing (which is different to DbNull). If a column is DbNull, I want to return Nothing, otherwise return the value. For eg:
Dim availableUnits As Int32? = If(myDataReader("UnitsInStock").Value, Nothing)
The error I'm getting is "Specified cast is not valid" but I'm not sure why. I've tried this as well:
Dim availableUnits As Int32? = If(isDbNull(myDataReader("UnitsInStock").Value), myDataReader("UnitsInStock").Value, Nothing)
Which is messy and just results in the same error. The only thing that works is this:
Dim availableUnits As Int32? If isDbNull(myDataReader("UnitsInStock").Value) Then availableUnits = myDataReader("UnitsInStock").Value Else availableUnits = Nothing End If
Which is just silly. Is there a better way of getting nullable db values into nullable variables that I'm not aware of?
col1 has some value. col2 has some value col3 has some value
[code].....
How can I show values from col4 on my form, maybe in grid. I know it have to be tokenized,but considering that I'm new, do you have some guide or idea how to do it?
First let me say that I am not sure whether or not this should go in this section or the API section, and if it needs to be moved I apologize. My issue is fairly straight forward, but for some reason I cannot get it to work.
I am trying to send a command to a command line and then submit the command. I have been trying without success to get this to work in v2008 Express and v2010 Express, Here is the code I am trying to us:
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" ( _ ByVal lpClassName As String, _ ByVal lpWindowName As String _
I am currently using psexec.exe from PsTools to send a command to a remote system to fire a command through a command prompt however I am finding that the shell I am doing does not seem to like the spaces in the path.
Any ideas on how I handle the following error thrown in the SqlDataAdapter.Fill as a result of the BeginTrans in the callee?
System.InvalidOperationException = {"ExecuteReader requires the command to have a transaction when the connection assigned to the command is in a pending local transaction.The Transaction property of the command has not been initialized."}
I want to add a new select command to my dataset. To do that, I have added a new partial class to my project. Because we have to use partial class if we want to extend generated dataset codes. [code]...
I am using a CheckedListBox that is populated with Filenames (full path, i.e. C:TestTest.jpg)When I have the files that I want in the CheckedListBox I wish to click a Start Button which will process the list one at a time using an exe program that runs on the Command Line. There are arguments that need to pass to the command line as well as the file location in order for the program to process.I currently have it working but the issue is the loop finishes quickly and it is left up to the CMD.exe to finish the process. What I would like is for the LOOP to wait until each file completes processing before passing the command for the next file in the CheckedListBox.There some reasons I wish for it to work this way.
1) I would like to have a button that can Pause/Restart the Loop.
2) I would like to have a button that can Stop the Loop so the whole process can end.
3) I would like to have the Loop remove each file one by one from the CheckedListBox after it has been processed.
4) I would like to display a Message once all the files have been processed.
5) And if it were possible I would like to report the status either by text or a progress bar showing where it is at in the process.
6) And the ability to add some error handling if possible.
Since the Loop finishes so quickly as it just passes the command to the command line using the & as a seperator it is the command line that is handling the rest of the process. Because of this there is not control over it in the GUI.The code I am using allows the Command Line text to display in the Form so it won't open up a seperate window to run CMD.exe. This is the desired affect as I would like everything to appear to run from within the Form itself.
User need to select their prefferable data to show in report. What i did is i have a clear command first to delete the temporary table. The temporary table is basically a table to stored user selection parameter data. After the clear command, i have a insert command to insert user selection data into the temporary table. What happened now is when i run the program exe, first run of the report is work fined, but not the second and the following times of execution. It will return null or blank report. The weird thing is when i execute it from development environment, it seem like the report is able to pick up user selection parameter and run the report for the first times and the subsequent execution.
i have seen this in many codes, just not sure where to start and how to call the command. what i'm talking about is having code as such (this is for save file dialog):
In the Windows Shell, there is a command that looks like this: copy /b fileA.zip + fileB.jpg fileC.jpg..Is there any equivalent function in VB.NET? I already know this works: [code] But I would much rather have a built-in function to work with. Here is what I am trying to do: url...Also, this doesn't just work for pictures. It works for any binary file. Is there any way in VB.NET to tell if a file is binary or text?
I am struggling to pass a parameter to a VB.NET application via a Windows scheduled task. It works perfectly in Visual Studio (passing a command line arguement via project properties).If I am calling a VB6 application, then I will supply the following parameters and it works:
Run: c:progra~1TestTest.exe TestParameter Start In: c:progra~1Test However, if I supply the same parameters in VB.NET, the program throws an exception when it tries to create an instance of a class in the Form.Load: System.NullReferenceException cannot create instance of object.
I have also tried the following:Run: c:program filesTestTest.exe TestParameter Start In: "c:program filesTest" This time the status of the scheduled task changes to "cannot start".What is the correct way to specify command line parameters in a scheduled task for a VB.NET program?UPDATE I found the solution on this web page:[URL}.. I am still confused as to why the program would not create an instance of an object when I used the 8 bit paths (i.e. progra~1)
I have beginner skills using VB (am using the Express edition to learn). I would like to know how to set up a conditional statement in a Windows Form (WF) app that would check if a specific command line has been passed by another separate app that launchesthe Windows Form app using command lines, and if not passed, then the Windows Form app would shut down (exit, close).So far, I can use:
For Each s As String In My.Application.CommandLineArgs If s <> "xyz" Then Me.Close()
In the Windows Shell, there is a command that looks like this:copy /b fileA.zip + fileB.jpg fileC.jpgIs there any equivalent function in VB.NET? I already know this works:Shell("cmd copy /b fileA.zip + fileB.jpg fileC.jpg")
In .NET, is there an equivalent of the "where" command that is present on Windows Vista and Windows 7 machines? I need to resolve the hard path to an executable that is defined in the system path at install time, and not everyone installs everything using the default installation path.
Currently I call the "where" command as an external process, but this only works on Vista and Windows 7 machines, this does not work on XP out of the box.
how to do a dos command in Visual Basic 2008?Maybe for example: shutdown a pc in your lan. It's with shutdown -s -m \PC_RYDER like this but in Visual Basic.