I got a value which is store in the array and i need to compare it. Which
if my user = 1,2,3,4,5,6 then ignore
if my user = 2,3,4,5,6 then i need to add in a ,1 which become 2,3,4,5,6,1
Here is my coding
user = dr("user_access")
dr.Close()
Dim splitX As String() = user.Split(","c)
For Each item As String In splitX
[Code] .....
Is there other way to compare the array or there is another better way to check?
Actually I have datetime value stored in the database. What I am taking from the textbox is a time value. I want to extract those results from the database which are between the given time value....To be more concise, my application is a booking system for a sports club and provides an option to view alreaady made bookings.. Here i offer two options either to view all bookings for a specific game or to filter bookings. In filter bookings one option is to filter through date and time...Date option is running okay but problem lies in time part...I provide two times but unable to view bookings between them...
My code is:
Dim prmtimefrom As New SqlParameter("@booking_time", SqlDbType.DateTime) prmtimefrom.Value = TextBox3.Text Dim prmtimeto As New SqlParameter("@booking_tim", SqlDbType.DateTime)
My experience with Stored Procedures is limited and I'm hoping this will solve my payroll problems. Further, for what I'm attempting to accomplish a Stored Procedure may not be the best answer.I'm attempting a Payroll function in which the goal of the Stored Procedure is to fetch the data for a given Payroll Period, do math on the first returned employee, output a calculated result, then move to the next. Let me explain a bit more...Based on a Pay Period ID which is given to the Stored Procedure, I would like it to do the following:Select the employee in that period, add a total of his hours worked, then add that employees total commissions, whichever amount is greater - return that value (along with the totals - such as the total hours and total commission) - then move to the next employee until completed.
I'm writing a report scheduler that is somewhat of a clone to the backupexec scheduler and the layout can be seen in post #10 here: [URL]..It works great and saves/edits/deletes records just fine, but now i need to compare those records one at a time in a windows service that i'm writing in order to trigger automated report creation and emailing - i already have the report and i already have the code for the emailing, i'm just looking for the most efficient way to loop through the table (that i've pulled in to a dataset) and compare its records with the current date and time - if true, the event fires.
[Code]...
1stSun, 2ndSun etc are bit fields, time is a datetime, and the remainder are varchar. My service checks the database every thirty seconds.The english version of what i'm trying to do is "Connect to the database, grab the entire table (it will always only have 5-6 entries max, so i felt 30 second sweeps was okay), and If today is the 1st Sunday of the month, and it is currently 11:00:00 a.m. (could be any day or time, this is just an example) - loop through the dataset to identify if any records match the time field or greater - if they do, fire the report
I have a whole bunch of information that has been parsed from a web page and i want to insert the data into a multi-demensional array and the compare the data of a certain array element to another array in the same format to determine which is missing/added.So if i have this:
Type of animal | Color | Age Cat, Brown, 15 Dog, Pink, 6 Fish, Orange, 4
[code].....
I only want to compare the type of the animal and the color and age is irrelevant.I want it to let me know whats missing and what's been added.Sounds bizarre but yeah. It doesn't need to be arrays, it's the only thing i know of though.
First of all - It`s my first post here so welcome I have a short question.I have an array with strings values, and a datacolumn with values of the same data type. The question is - what is the most efficient method to find values which are in the array, but aren`t in the datacolumn?
I've come up with the following and it's partly working.
Public serial1, serial2, serial3, serial4, serial5 As SerialPort Public serialports() As Object = New Object() {serial1, serial2, serial3, serial4, serial5} dComPort = "COM4"[code]....
The above code works fine! But im having trouble trying to now retreive whats stored in the array.In the above example, an entry will be stored in serialports(4), all other array elements will be blank.If I do this it works.
MsgBox(serialports(4).PortName) ' this retuns the value COM4
But I'd like to loop though all array elements and print out ALL the PortNames, The below code doesnt work, I get an error Object variable or With block variable not set.
For i = 0 To serialports.Length - 1 MsgBox(serialports(i).portname) Next
Basically what I'm trying to do is this, I have 20 statements in a Select Case (right now they're just labels for my own testing), I have a random number generator that will generate a number between 1 and 20. Since I don't want the same statement to repeat during the individual run of the program I'm trying to generate a random number, then check it in a dupeCheck method, then if it isn't a dupe I'm trying to return it to the select case and put it in the array so that when I choose the next random number if it's the same the dupe check method will catch it and return a False boolean and then the random method will do a recursive call to itself to generate a new random number and the whole thing starts again. I'm populating the numbers into the select case just fine, but VB keeps telling me that my functions aren't returning values on all paths, and stepping through I can see that the recursion isn't happening and that it's just sending the repeat number back, but I can't figure out where my major issue is. I'll show you my current skeleton code for the "GuessOrDie" as well as the first manifestation of the code I wrote for it a couple of days ago (the old code had infinite recursive calls and array out of bound exceptions)
I would really love it if you guys could take a look and let me know what mistakes I'm making, I'm having big problems moving from FOR loops in java to For/Each loops in VB and I suspect that is a big part of my problem.
Current Code: Public Class GuessOrDie Dim questHistoryArray(19) As Integer Dim indexCount As Integer
I have two array list same size, depending on the information gathered by previous functions. The size of the arrays range from 2 - 45 in length, both arrays always have the same length. I am trying to match one string in one array to another string in the second array. When they match then add Item to List.
Here is my Do Until i = Arraylenght info = Replace(myAL(s), " ", "") SortedArrayList(m) = Replace(SortedArrayList(m), " ", "") SortedLine = Split(SortedArrayList(m), "Price=") If myAL(s).Contains(SortedLine(1)) Then [Code] .....
This code works up to an array of not more then 4 in lenght, when working larger size array then 4, the minute it get to 5 I get this Error: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index
I have a query in Access 07 that identifies the following fields: ContractID, status, start date and end date. For each contract, I've been able to search a network share and upload its corresponding file; however I need to skip the import and write a record to a table for contracts with the same start and end date. I've included a placeholder (in bold below), but how do I make the date comparison work? Do I need to create a multi-dimensional array for that or can it be done with the code I have?
Private Sub cmdRefreshList_Click() DoCmd.SetWarnings False 'Create an array based on the true-up contract IDs.
Getting some errors with a loop. It's a log-in app that has username, passwords & account type stored in a SqlCe database. I would like it to sync with a larger database for updates that has not been made so i left it out but I have started to make a loop that would connect it to the larger DB and if connection failed would try a set number of times before stopping the program. I'm coding this project with Visual Studio 08 pro
Dim conndb As New SqlCeConnection("Data Source = |DataDirectory|\Mydb.sdf") Dim x, y, z As Double x = 1 y = x + 1 z = 5
This application should ask the user for a percentage amount by which each price should be increased then increase each price by that amount and then display the increased amounts. I can't seem to get it to calculate the amounts. Everything else seems fine. Any suggestions, ideas or recommendations? [Code]
Im new to database programming and was wondering if you can save a select statement to an array:I tried this but obviously wont work, does anyone have any ideas?
Code: Public Sub store_select_star_to_array() Dim myCommand
I have put together an array for data from two text boxes to be stored in. This works fine at the moment. I am now looking to build some form of array that will have some stored data in it already, so that someone can select the information they require from a listbox.
Basically, the user can type in a name and a job description into two different txt boxes and then click add. It then adds the name to the listbox and stores it in a string list (Public strList As New List(Of String)) it also stores the job description in a string list as well (Public strListDescription As New List(Of String))Then when you select an item in the list box it knows what data to bring up in the txt boxes using an array with these lists:
Code: Private Sub lstMyCourt_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lstMyCourt.SelectedIndexChanged Dim i As Integer
then, in a 1D array I store the player's numbers, simply as
0 23 1 16 2 19
[code]....
I want it to take each number from the player's number array individually and compare them to each row individually in the lotto results array i.e. the first six cells in each row in the results array will be compared with each user number to find any matches, if a value matches then a count is incremented. if the count is greater than 2 but i'm getting no where with it :( i've been trying to use the For To loops but keep getting index out of range, or else nothing is happening at all!
I am selecting a distinct user from IT_Cases_List and stored it in an arraystaff(). From this array, I will then call a Stored Procedure to count the no of cases attended by this user,(arraystaff(i)) and loop it until arraystaff.length-1
but the problem is that the count does not tally.
Sub getStaff(ByVal month As String) If Not con.State = ConnectionState.Closed Then con.Open()
[Code]....
ok, i've called only once getcases but i'm still having the same problem.
this is what i get when i run the program:
if i get Count(*) from the database, the total no of cases i should be getting is 132, whereas the total of cases i get from the program is 157 (7+7+20+20+49+49+5)
if i run the query from sql, this is what i should be getting
i notice that the Count number gets duplicated (7,7,20,20,49,49,5) instead of (7,20,49,5,10,27,13)
Write a function that will take one integer input parameter, create a sequence of numbers stored in an array from 0 to that number, and the numbers are a summation. For example, given 7
I have some data, stored in a byte array, compressed with LZSS compression. I've crawled the net for the last 2 days trying to find some code to decompress this data without success. Has anyone come across a suitable routine that can help?
I have a stored procedure in DBML and I try to pass the result to "sqlQryArray" as an array(1 dimensional array). But the bottom code causes error like below message. What else should be done?
Error 1 Value of type '1-dimensional array of aaaDatabase.stp_GetSomethingResult' cannot be converted to '1-dimensional array of String' because 'aaaDatabase.stp_GetSomethingResult' is not derived from 'String'.
The return result from stored procedure is a just list of first names of students(only one column)
Dim sqlQry = aaaLINQ.stp_GetSomething(bbb,ccc,ddd) Dim sqlQryArray As String() = sqlQry.ToArray()
I have a data entry form, a listview form and a couple of classes. Data is entered in the form, and it is stored in an array. This is then displayed in a listview. I can insert and delete just fine, but I cannot figure out how to modify. This is what needs to happen: With a row selected in the listview, modify is clicked in the menu strip.
Whatever information is in the selected row, it needs to be transferred to the data entry form where changes to it may be made. I have attached what I have so far, and a sample data file is provided in the root directory. I think I need to temporarily store the selected item, put it into the data entry form, delete it, and when submit is clicked have it re-inserted.
In my desktop, I have folder containing some word document files. I want the filenames of the documents in that folder. So, I used: Dim strFiles() As String = IO.Directory.GetFiles("X:Documents and SettingsXXXDesktopvvvvv", "*.doc") All filenames are stored in that array. But it would also include the temp document that Word generates. I am somewhat confused on how to remove this from array. I only need full filenames of the actual documents, which excludes the temp document.
I try to read the ID3 Info from a .mp3 file by reading bytes, and then i convert it to a string, and try to compare it to a string (that contains the same word(s)) but wasnt a byte stream beforehand anyhow ALL of my converted strings have a length of 31, regardless of if its a string that says "John" or a string that says "Teenage Mutant Ninja Turtles" how can i make my converted string have the correct length? John = 4 NOT 31!!??
I am coding a program for a movie trivia game that randomly shows a movie quote and the the user selects a movie name from a combo box that matches. I used a array for the movie quotes and a comboBox for the movie names. I have coded a portion of the program but I am stuck on how to compare the array quote being shown to what movie the user selects from the comboBox. I have tried numerous different things but none seem to work right. The way I have it coded now it shows that every movie I pick that it is right even if it is wrong. I am going to show part of the code here and also attach the entire solution for anyone that needs it .