Im creating a quick utility program that deletes any invalid data within my database. This works fine and im happy with it. I was thinking why not backup this table first before modifying the bad data, easy! I was Wrong. Seems to be a problem with my sql command and the way vb passes it.
Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
con.ConnectionString = "Provider=ASAProv;" & "Data source=MY_DSN;UID=dba;PWD=sql"
I have a stored procedure with two input and one output parameters. I need to execute the stored procedure from VB 2008 code passing it two parameters and returning the output parameter. How might I go about doing this? I don't have how to do this. Newbie here.
Here's a simple code snippet of a larger function as an example.
Using conn as New SqlConnection("conn string") Using find as new SqlCommand("ExampleProc",conn) Dim rParam as new SqlParameter("@RESULT",SqlDbType.Int)
[code]....
I know the Output parameter is returned after the SqlDataReader is closed. From what I think I know, the Using statement will call .Dispose on the SqlDataReader, so will that basically wipe out the Output parameter? If so, what is the best method to call a SqlDataReader that also contains Output parameters that closes and disposes everything correctly? Let me add that based on what I've read you only have access to the Output parameter using a SqlDataReader after you call .Close on the SqlDataReader.
trying to write a simple app that queries an access DB based on date .. the SQL looks like this and works fine with a date hard wired into the select:
SELECT Terminal_ID, SUM(Transaction_Quantity) AS Total FROM tblTransaction WHERE (TransactionType_ID = 3) AND (Transaction_DateTime > #1/1/2009#) GROUP BY Terminal_ID
On the main form I have a monthcalendar control named 'FromDate' and a DataGridView control that shows the SQL results.
How do I get the user's selected date incorporated into the SQL statement that returns the results in the datagrid?
Something like:
WHERE (TransactionType_ID = 3) AND (Transaction_DateTime > Fromdate)
I have a function that returns a Datatable. I am passing a list of Integer as an argument. Then I thought tis would work.
Public Function GetEventsByEventType(ByVal EventType As List(Of Integer), ByVal DayInterval As Integer) As DataTable Using con As New MySqlConnection(strCon)
[Code]...
as you can see. I use string.join to convert the list of integer to something like this. '1,2,3'. Problem is that is read as a string so i get the incorrect results. I need to have where EventType IN(1,2,3).
How to use crystal report with VB.NET by passing the SQL statement? Try to pass sql statement to a crystal report in vb.net 2008 after creating a dataset with it yet it will load the report but not showing the records
What I am trying to do: There are three powershell scripts with different time delays as shown below.I am trying to run them asynchronously in .NET and I followed this article to implement Asyncrhonous programming. Where I am stuck:The I am not able to retrieve output after the events are invoked.The scripts are being called but then the program ends and it shows "Press any key to continue" in console windows.I don't what I am missing here.
Info: JobRequest is a class that I use to pass around information keep track of jobs.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Microsoft.VisualBasic.Interaction.Beep() System.Diagnostics.Debug.WriteLine(3 + 2) End Sub
Why I don't see in Output window number 5 as output?
I'm just going to throw all my code in here in case there's something wrong with a piece of the code not in the "SelectName()" sub.
Module Module1 Dim selectednames As String = "" Dim index As Short = 0 Dim inarray As Boolean = False
[code]....
Here's an image of what it does (I suppose you can see what went wrong)13 inputs, 3 outputs expected, only 1 output given.As from what I've figured out so far, it's doing the correct amount of loops etc. It's just as soon as it starts generating the "winner" for the 2nd game key it doesn't get a string value from namesarray.Also, why is
For x = 0 To totalnames - 1 Debug.Print("namesarray(" & x & ") = " & namesarray(x)) Next
I was convinced that If <expression> Then <statement [:statement]> Else [statements] in concrete form of If a = b Then SayHello() Else SayBye() End has sense. I read article on msdn on If-then-else, but I forgot why I was reading, so I concluded, that snippet above means this
If a = b Then HelloIsSaid : IsNotEnded Else ByeIsSaid : IsEnded But I have tested it now, and I see, that Else without statement is nothing more than decoration. It would be pretty good if it had function I described. Do you think its good request? Or do you know any circumstance where this Else has some function?
I want to put it (the select count statement) in this LINQ statement so I can get the sales count in my linq statement: Dim TheLeads = (From L In DB.Leads Where L.IsDeleted = False Select L).ToList() Is this possible to do in LINQ?
add an if statement and an exit statement to my do loop that exits when my future value (FV) is greater than 1000, then to change the exit statement to a continue statement so my loop will continue even though my fv is greater then 1000, point is to get this to run even though my if statement doesnt do anything. problem something wrong in my code and an exception error (xception of type 'System.OverflowException' occurred in mscorlib.dll)
so can someone show me where or why I have an error is, what am I overthinking now! I could use a hint, OMG i could use a tutor for that matter
I'm writing something that will examine a function and rewrite that function in another language so basically if inside my function F1, i have this line of code var x=a.b(1) how do i break up the function body into symbols or "tokens"?I've searched around and thought that stuff in System.Reflection.MethodInfo.GetMethodBody would do the trick however that class doesn't seem to be able to have the capabilities to do what i want..dit 2:basically what I'm trying to do is to write a program in c#/vb and when i hit F5 a serializer function will (use reflection and) take the entire program (all the classes in that program) and serialize it into a single javascript file. of course javascript doesn't have the .net library so basically the C#/VB program will limit its use of classes to the .js library (which is a library written in c#/vb emulating the framework of javascript objects)
im using Trace to trace and debug my Application which works fine. Now i wanted to output my Trace Information to a text file like below:
Dim c As Integer = Console.ForegroundColor Dim ts As TraceSwitch = New TraceSwitch("SPMassUploader-TraceSwitch", "") Dim tw As New TextWriterTraceListener(Now.ToString("yyyyMMddHHmmssfffffff") & "-" & "output.txt") Trace.Listeners.Add(tw)
how to use them then before, but am still a little confused with a few aspects. Here goes:
1.) Lets say you have a method that checks for a certain condition(s) and if it fails Throws an exception. Does it have to be in a try/catch block? Meaning can the "Throw" statement exist in a block with no try/catch statement?
2.) Now lets say we have a method that has a try catch block and in it there is a throw statement. When the throw statement is executed does it first try to find an appropriate catch block in the same method or does it immediately go back to the calling method without looking at the catch statements in the current method where the exception was thrown?
3.) I created a custom exception class that inherits from ApplicationException. Next I created a method which has a catch block that catches this type of exception and does some action. Is the System(i.e CLR) smart enough to throw an exception of this type, or does it only throw exceptions from SystemException?
4.) I know that some people are more liberal in their use of exceptions and others use it more sparingly when truly strange stuff happen like the DB going down. I am writing code where I am getting some info back from the database, converting it and then storing it. Sometimes there might be data that comes back from the database and other times the field is empty and the Null value comes back. Therefore in the instances where Null comes back from the database I should not convert the value to anything, since I will get an error. What should I do in this situation? Should I let the CLR throw the exception when it goes to convert the Null value or should I check for the Null value and if it exists not convert?
5.) In general when I throw exceptions, is it sensible to only throw exceptions of the type Application Exception or are there instances where the programmer throws exceptions of the type SystemException?
I'm building a listview search feature in my app. (See the code below). It works really well, except if you search "T" then the code removes all items, if you search "t" then it removes every item except for those starting with "t". Is there any way to make a 'like' statement, or use some kind of wildcard to make the statement not case sensitive?
For Each itm As ListViewItem In ListView2.Items If itm.Text Like TextBox1.Text & "*" Or itm.SubItems.Item(1).Text Like TextBox1.Text & "*" Then Else
I have a line of code that is working in one statement but not the second statement. I'm not sure what I'm doing wrong, I am learning slowly but surely, and it is by no small margin because of the ave found here =) The error is occuring in the intResult = intSelection x intCount line of the SECOND Do While Loop.
The blue squiggle line is under "intCount" just FYI Dim intSelection As Integer Dim intCount As Integer = 0
I have the following vb code which works as expected when it's in a code-behind page. I tried to move it to a shared or component page since I will need to use it in multiple pages:
Imports Microsoft.VisualBasic
Public Class DetTime 'Determine eastern time
[CODE]...
However the "if" statement shows an error " statement cannot appear outside of a method body" and the Microsoft solution is to "move statement into a procedure or subroutine"
I have coded a case statement that changes the background colour of a panel. [code]When the code is run, it works for the case of colour1 that is NOT 1 or 2. However, when the colour1 is 1 or 2, it is supposed to pick a number from set array and run another case statement. Instead, it only picks the last value (for 1, this is 5, and for 2, this is 7).
I am working on this project in .net. When you go over to the browser you will see five different restaurants and the button below says to change color and if you click on that you are able to change it. What I am trying to do is beside the name of the restaurant have the address, phone number but I really don't know how to code it in. I'm sure I do but my mind is not remembering how to do it. Below are my codes..
Here is my class code:
Public Class Restaurant Private _Id As Integer Public Property Id() As Integer
[Code]....
how to write the phone number and address beside the restaurant so that way they all show up.