Pass A Public Variable To A Sql Query?
Nov 4, 2010
I have a public variable that I declared in form1 of an application. I am trying to call that variable in form2 and then pass that variable in a sql query.
If I declare
Public Class Form1
Public payPeriodStartDate, payPeriodEndDate As Date
How then to I declare that variable in form2 and how to I pass it to my sql query
SELECT [Exceptions].Employeenumber,[Exceptions].exceptiondate, [Exceptions].starttime, [exceptions].endtime, [Exceptions].code, datediff(minute, starttime, endtime) as duration INTO ScratchPad2[code].....
View 13 Replies
ADVERTISEMENT
Nov 17, 2010
I have 2 public variables that I declared in form1 of an application. I am trying to call that variable in form2 and then pass that variable in a sql query. [code]...
View 2 Replies
Apr 19, 2012
I need to pass a string variable into a wql query:
Dim booking As String = System.Configuration.ConfigurationManager.AppSettings("PlayersFile")
Dim query1 As New WqlEventQuery( _
[Code]......
However, I'm uncertain how to make the variable booking parsable by the query.
View 2 Replies
Nov 17, 2010
I have 2 public variables that I declared in form1 of an application. I am trying to call that variable in form2 and then pass that variable in a sql query. [code]...
View 14 Replies
Apr 18, 2011
My goal is to make the content of TextBox1 to depend on the value chosen in ComboBox1. My code is as follows:
Imports System.Collections
Imports System.Data
Imports System.Data.OleDb
[Code].....
View 5 Replies
Mar 17, 2009
Upon entry into my database, frmLot opens. The form opens in datasheet view. It displays several fields to include one named WorkOrder. The user clicks in the cell named WorkOrder. In the On Click property, I store that variable and name it stWorkOrder. What I need to happen then is to pass this variable to the criteria field of a query named qryWorkOrder and have it run and display results.
View 1 Replies
Oct 9, 2010
I've been trying to add a database to my interface, and i can't seem to filter the data, i want to search based on last name and only display people with the that last name (the last name will be entered in a search form).I've tried writing SQL Queries but I can't seem to pass the variable that that holds the last name into the SQL Query, to filter the data.
View 3 Replies
Aug 26, 2010
How do declare a public variable .aspx web page that can be used in all the pages within my web application?
View 3 Replies
Jan 14, 2012
My plan is depending on the users screen resolution a different form will open. Thats all fine and works hunky dory.
However, the form pulls code from a public sub and updates fields on the form based from the public sub[code]...
My problem is how can I change the FORM1024x768 to say FORM1366x768 if the users screen resolution determines a different form is chosen. I need something like[code]...
View 7 Replies
Sep 5, 2010
Using Visual Basic 2008 Express. I need to pass a variable to another form. Or else make the variable visible to both forms.
View 4 Replies
May 8, 2012
I have inherited some god awful vb.net code and having trouble trying to work out the generics for looping through the current structure in place.
here is a snippet of the struct
Public Structure ApplicationDetails
Dim ID As Integer
Dim AgentID As Integer
[Code]...
but i am not sure on the syntax to set the value and when trying to get the type i get item.GetTYpe() is not declared.
View 2 Replies
Mar 25, 2010
I am getting the error:"Range variable 'sender' hides a variable in an enclosing block or a range variable previously defined in the query expression."for this
Imports System.Data.SqlClient
Imports System.Linq
Public Class Form1
[code]....
I can select any other item from the table without the error. "sender" has the same properties as "receiver" in the SQL table.
View 2 Replies
Jul 15, 2010
What is Different between global variable and public variable?
View 1 Replies
Oct 31, 2009
I would like an overview of System.EventArgs. I have an understanding of System.Object where I can pass data between subroutines and functions using Public Classes. I am curious what EventArgs do?
View 3 Replies
Apr 7, 2012
I am trying to run a query an Access db from VB. The general query which I want to run is
SELECT * FROM Patient WHERE Patient.PatientID = ?
or SELECT * FROM Patient WHERE Patient.PatientLname = ?
I tried using an input box which captured the user input and pass that variable to the query, but that failed. Then I read about writing a function and using that, however, I keep getting an error which says Function not defined, but when stepping through the code, it seems to work. Here is my function: [Code]
View 1 Replies
Apr 13, 2009
I'm getting an error in .net when trying to declare a Public class on my code behind page.
Partial Class _Default Inherits System.Web.UI.Page
Public someVariable as integer
Public someClass as className
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load [...]
The error I'm getting is BC30508: 'someClass' cannot expose type 'className' in namespace '<Default>' through class '_Default'.The goal here is accessing the class properties in script blocks on the aspx page like this <%=someClass.classProperty%>
I'm not sure if I'm trying the right methods (I've tried several ways of declaring the public class) or if it can even be done..
View 3 Replies
Apr 23, 2012
Later on i have a form where a cost for a class is calculated by timing the duration of a class by the costperhour textbox which is in a different form.
View 3 Replies
Oct 28, 2009
I have few public Arrays variables, I need to reset them since I will be using them few times with different values.
View 3 Replies
Jun 29, 2011
I have an arraylist in a user form (Mainform) that I would like to be able to share among multiple forms and edit the contents. Using the Public Shared method I have been able to view and even edit the arraylist, but it does not seem to be changing it back on the main form. I can give more detail if needed.
View 9 Replies
Jan 19, 2010
Is there any point in using a property (rather than a public variable) if it just says:
[Code]...
View 1 Replies
Oct 31, 2010
I want al(InitialStrength.Text) to be set as the variable iST so I'm typing this at the top of the page before all my subs:
Public Class CharacterSheet
Public iST As Integer = Val(InitialStrength.Text)
[code]....
but every time I do that and try to compile without even using the variabe, I get this error: "An error occurred creating the form. See Exception.InnerException for details. The error is: Object reference not set to an instance of an object."
View 5 Replies
Aug 22, 2011
I have this public class
Public Class commonSettings
Dim etcString As String = "some string"
End Class
How can I call etc String and use it entirely on my code?
View 3 Replies
Aug 23, 2009
I have a public variable which seems to be going out of scope. I am confused as it has been dimensioned as a public variable: Public xlCell as As Microsoft.Office.Interop.Excel.Range
I originally had all my code in the same module in the same project and it was wrapped within a For/Next Loop (Example 1). I decided to clean up my code and make it more modular (Example 2). All the code is still in the same module in the same project.
Upon doing so, my public variable is not recognized in any of the private subs that I have created. I keep getting the following error: Message="Object reference not set to an instance of an object." When I test the variable using ?IsNothing(xlCell) in the Main Sub I get False in the main sub. this tells me te variable is recognized. However as soon as the Call SelectCaseSub() is triggered, I get a True value for ?IsNothing(xlCell). Why is this? Shouldn't this variable be in scope regardless?
[Code]...
View 6 Replies
Aug 9, 2010
I defined a variable in a form with
Then I want to check that variable in an other Form using[code]....
View 3 Replies
May 3, 2012
When using the variable tTimeInterval as Long trying to reassign the variable in the timer's sub,
but the tTimeInterval is 0 after enter in the sub,,
Public tTimeInterval As Long Sub Main()'Dim param_obj(2) As Object 'param_obj(0) = "sdaddsa"
'Dim aThread1 As Thread = New Thread(AddressOf SendingMessage4)
'aThread1.Start(param_obj)tTimeInterval = 5000
[Code]...
View 1 Replies
May 28, 2009
I have a query that brings back a result that I want to be able to use on all forms in my project. Is there a way to store this until the application is terminated?
For example,
I'd like to store the result of this:
Dim ssSQL As String = "SELECT ClaimNo, Custodian, Activity, Code, DateStamp FROM [Activities] WHERE "
ssSQL &= "[ClaimNo] Like ('" & txtClaimNum.Text & "')"
[Code].....
View 6 Replies
Jan 10, 2012
I currently have two forms, and I need to share the value of a variable in one of them.
I declared the variable to be 'Public Shared', and assigned a value to it. However,
when I inspect the value it appears as 'Nothing'. Here is the snippet:
Public Class A
Public Shared sVar As String = Nothing
Private Sub A_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
[Code]....
View 4 Replies
May 28, 2009
I have a query setup on the start form in my project - it looks for a user level (1 or 2 right now) I want to display/hide items on the form based on whether or not the user's permission (derived from this query) is a 1 or 2.
My question is, can i create a public variable out of this query to use on any form until the application is quit?
The query will be formatted something like this:
Dim
ssSQL As String = "SELECT UserLevel FROM [Employees] WHERE "
ssSQL &=
[Code].....
View 20 Replies
Jun 13, 2012
Just working on getting more fluent in Visual Basic over the summer so I'm still sharp for my next visual basic class. My teacher went over variables, but only in local scope.I have looked everywhere, but I can't find exactly what I need. I'm making an alarm clock of sorts, and I have this code to populate the minute array and the hour array.
Public Class Form1
Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
[code].....
View 3 Replies
Feb 25, 2011
I have public variables in a module. I need to get the reference of the variable by using the String name of variable in another formell me how to do this?I need something like the following code:
Dim Var1 As string
Dim sVariableName As String = "Var1"
GetReference(sVariableName).SetValue = "testing"
[code].....
View 2 Replies