4,901 Posted Topics
Re: Any database that supports SQL queries should work with k's query above. It is a simple inner join with no implementation specific keywords. A very good explanation of joins (inner and outer) with clear examples can be found [URL="http://www.programmerinterview.com/index.php/database-sql/inner-vs-outer-joins/"]here[/URL] | |
Re: Help is given when effort is shown. Read a book and pay more attention in class. Then write some code. If it doesn't work we'll try to show you how to correct it. If you've already covered this topic in class then reread your notes. | |
Re: If it is only shutting down while you are gaming then I'm thinking it is an overheating problem. Quick and dirty test - fill a plastic bag with snow (good time of year for this to happen), put a thin towel on the bag and put the laptop on the … | |
![]() | Re: You declared a bunch of doubles then you didn't use them. Your comparisons use redundant expressions in some cases and incorrect comparisons in others. Use intermediate variables to remove redundant conversions (and to allow checking in the debugger). [code] If chkOvertime.Checked = True 'bad - *.Checked is already a boolean … |
Re: Right after the line where you create the query, please add the following MsgBox(strsql) and post the results for us to see. | |
Re: tl;dr? How about this [code] Public Class Form1 Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load Dim words() As String = Split("Some luck lies in not getting what you thought you wanted but getting what you have which once you have got it you may be smart enough … | |
Re: Can we see the full information? Names and structures of the tables as well as the exact query you are running to do the delete? | |
Re: You can declare the list as [code] Dim names As New List(Of String) From {"John", "Fred", "James", "Jen", "Archie", "Brenda", "Melissa"} [/code] Use the random number generator to get a new random number from min=0 to max=names.Count. Because max (at least according to Microsoft) is actually one more than the … | |
Re: If the two listboxes have Sorted=True then [code] Private Sub btnAdd_Click(sender As System.Object, e As System.EventArgs) Handles btnAdd.Click If ListBox1.SelectedIndex >= 0 Then ListBox2.Items.Add(ListBox1.SelectedItem) ListBox1.Items.RemoveAt(ListBox1.SelectedIndex) End If End Sub Private Sub btnRemove_Click(sender As System.Object, e As System.EventArgs) Handles btnRemove.Click If ListBox2.SelectedIndex >= 0 Then ListBox1.Items.Add(ListBox2.SelectedItem) ListBox2.Items.RemoveAt(ListBox2.SelectedIndex) End If End Sub … | |
Re: Can you be more specific on the look and feel of the control you are looking for? "Some sort of calendar" is not a lot to go on. If you just want a datebook type program there are several free ones available. Several can be found [URL="http://www.newfreedownloads.com/find/datebook.html"]here.[/URL] There is also … | |
Re: Does the leftmost cell actually start with "#"? If it does then it looks like your match will always result in True for any line because you are testing using StartsWith. Are you sure you don't want to test the target of the jmp ("3" in your example) with cell(0) … | |
Re: What is your declaration for varCampArray2? My first guess would be that it is not an array but a collection. Ubound is for arrays. | |
Re: If this is a single user application then the database should not be open when the application starts. I'm going to assume, then, that this is a network available database that is available to more than one user. I presume that by [QUOTE]when the application is running no one should … | |
Re: You can also sync your computer clock with the server. From the command shell you can do D:\temp>net time /? The syntax of this command is: NET TIME [\\computername | /DOMAIN[:domainname] | /RTSDOMAIN[:domainname]] [/SET] Then you can just get the date/time from your own computer. You can get just the … | |
Re: Instead of doing repeated ReDims, you could just declare a list of the required type then "Add" new items. [code] Dim ClientRecords As New List(Of BankAccountClass) Dim AClient As New BankAccountClass AClient.FirstName = InputBox("Enter first name", "Enter") AClient.LastName = InputBox("Enter last name", "Enter") AClient.AccountNumber = InputBox("Deposit Amount", "Bank Account Program") … | |
Re: You don't need to have two separate loops depending on the relative number of rows. You can do it in one loop as [code] Private Sub btnCompare_Click(sender As System.Object, e As System.EventArgs) Handles btnCompare.Click For Each rw1 As DataGridViewRow In DataGridView1.Rows For Each rw2 As DataGridViewRow In DataGridView2.Rows If rw1.Cells(0).Value … | |
Re: The poll question does not jive with the choices. Help me? o Like o Dislike | |
Re: What line is generating the error? And what is the structure of your database table? It might also help if we knew what type of database you are connecting to. For example, Microsoft SQL Server uses select GETDATE() to get the current date/time. You can use that right in the … | |
Re: If item_code, qty, item_rate and item_tax are unique then they don't have to be qualified (as in with a. or b. but it is good practice to qualify them anyway for clarity. You didn't give the entire line of code. You are building a string query but I can't see … | |
Re: You use an inner join to combine two tables. A very good explanation of joins (inner and outer) with clear examples can be found [URL="http://www.programmerinterview.com/index.php/database-sql/inner-vs-outer-joins/"]here[/URL] | |
Re: Can't comment on the WebBrowser portion but I do have a couple of things to point out. You can replace each block of [code] If TextBox3.Text = String.Empty Then MessageBox.Show("Please enter a subject", "Subject Required", MessageBoxButtons.OK, MessageBoxIcon.Error) End If If TextBox3.Text = String.Empty Then Exit Sub [/code] with [code] If … | |
Re: You can try [code] If frmOther.ListBox1.Items.Contains(txtMasked.Text) Then 'login OK Else MsgBox("name not found") End If [/code] Assuming your other form is called frmOther, etc. | |
Re: Use the Split method. It takes a string and a delimiter and returns an array of tokes split at the delimiter. For example [code] Dim test As String = "The-quick-brown-fox" Dim tokens() As String = test.Split("-") [/code] results in tokens being assigned as follows [code] tokens(0) = "The" tokens(1) = … | |
Re: You need a timer. You will also need a class variable to keep track of which item in the listbox is the next one to copy. When it gets to the last item the index will be reset to the first item. You don't need a loop. The iteration will … | |
Re: What am I missing here? I'm seeing a lot of brute force code to simply export a listview. What are you trying to export the listview to? What viewmode is the listview in? I've written a few examples of exporting listviews and gridviews to Excel spreadsheets and none of them … | |
Re: Certainly. I've done it from time to time. You just have to use the correct connection string (see [URL="http://www.connectionstrings.com"]here.[/URL]) I do not have MS Access installed. | |
Re: First suggestion is remove all of the single quotes. They are only used for string field values in queries. I have MS SQ, not Oracle so I can't comment on the rest. Try the quotes and see how that works. | |
Re: Another possibility (fewer layers) is to use ADO as in [code] Dim con As New ADODB.Connection Dim rec As New ADODB.Recordset con.Open("Driver={SQL Server};Server=.\SQLEXPRESS;Database=mydb;Trusted_Connection=yes;") rec.Open("select count(*) from admin where username='John'", con, CursorTypeEnum.adOpenForwardOnly) If rec(0).Value = 1 Then 'record exists Else 'record does not exist End If rec.Close() con.Close() [/code] A table … | |
Re: You should be using a try/catch block like this [code] Dim totprice As Decimal Try totprice = CDec(txtPrice.Text) MsgBox("value is " & totprice.ToString) Catch ex As System.InvalidCastException MsgBox("not a number") End Try [/code] If the conversion is not successful the "Catch" portion will be executed. Another way to test without … | |
Re: If you want to use a different file name then you have to generate a new name for the SaveAs. For example, you might want to generate numbers 0001, 0002, etc and append to "vbexcel" to create vbexcel0001.xlsx, vbexcel0002.xlsx, etc. Or you could generate a name like "vbexcel-yyyy-mm-dd-hh-mm.xlsx" using the … | |
Re: Once the form has loaded and the text fields have been populated, you could loop through the text boxes and make a copy of the contained text in the Tag property of each control. Of form close you could compare the values of TextBox#.Text to TextBox#.Tag to look for changes. | |
Re: Possibly silly question, but if you are creating the folder in the form load handler, then how can you have access to the ID number used to log in? I would assume that the user would have to log in first, and the log in area would not be available … | |
Re: Here is another method that uses the NorthWind database as an example. Probably not the best solution but it IS "a" solution. [code] Dim con As New ADODB.Connection con.Open("Driver={SQL Server};Server=.\SQLEXPRESS;Database=NorthWind;Trusted_Connection=yes;") Dim rec As New ADODB.Recordset rec.Open("select top 1 * from Categories", con, CursorTypeEnum.adOpenForwardOnly) For i As Integer = 0 To … | |
Re: You could save the last loaded file name in a text file or a My.Settings string variable at form close. To do it in My.Settings, go to your project properties and the Settings section. Define a new string value (this example uses the name LastLoadedFile). When the form loads you … | |
Re: select * from word Selects all fields in the table including the primary key (assuming one is defined). It's a little hard to tell if the OP included the spaces between the query tokens, though. | |
Re: O.P. said it was a one row Access table so updating all records wouldn't be a problem. SQL usually uses single quotes around string fields. Double quotes are acceptable but it makes it a little messy when creating strings like query = "select * from table where username=""" & user … | |
Re: If I understand your problem, you have a listview ini details view. Each row contains a login/logout time and an employee number. A row gets added when a user logs in and, when the user logs out, you want to update that row with the logout time. Is that correct? … | |
Re: If I had to it I would load the code into a text editor (like TextPad) that supports regular expressions and change "," to ",\n". If you don't have one then copy the following code into a file named (as an example) change.vbs. [code] text = "Dim row() As Integer … | |
Re: At the risk of sounding overly picky, in your first post you said "click log out", and in your next post you said "click the button 'TIME OUT'". Note that in neither picture do you have a button labeled as "log out" or "TIME OUT". It helps to be precise. … | |
Re: You could declare some variables with class scope such as [code] Dim numFailed As Integer 'number of consecutive failed login attempts Dim lastAttempt As Date 'date & time of last login attempt Dim lastUser As String 'name of last user to try to login [/code] In the form load event, … | |
Re: The combobox will be populated with the data in column 1. When an item in the combobox is selected, the corresponding value from column 2 will be displayed in the textbox. [code] Private Sub ComboBox1_SelectedValueChanged(sender As System.Object, e As System.EventArgs) Handles ComboBox1.SelectedValueChanged txtExcel.Text = ComboBox1.SelectedValue.ToString End Sub Private Sub btnLoadExcel_Click(sender … | |
Re: You use the CONVERT function. The first parameter is the type you want to convert to (in your case, string), the seconbd parameter is the field to retrieve. The third parameter determines the format. For example select CONVERT(varchar(50),checktime,101) Allowable formats are [code] 100 or 0 mon dd yyyy hh:miAM (or … | |
Re: It would also help if you posted the structure of your table (field names and types) | |
Re: Can you be more specific as to the client's requirements? By POS do you mean "Point Of Sale" or are you referring to a "Piece Of S**t" computer? You won't find a scanner these days that uses the old serial port - just USB. Pretty much all scanners come with … | |
Re: Last question first. ReadAllLines reads the entire file into a stringt array where each element is one line of the file. ReadAllText reads the entire file into one long string. | |
Re: In English, what data are you trying to display? | |
Re: Please refer to the excellent point raised by jbennet [URL="http://www.daniweb.com/software-development/vbnet/threads/411990/1758782#post1758782"]here[/URL] regarding why you want to use substituted parameters. | |
Re: SQL server supports the COALESCE function. I seem to recall that Access has something similar Nz(Value, [ValueIfNull]) I don't have Access installed so I can't verify this. | |
Re: It would really help if you told us what you were missing. By the way, it is not necessary to have "End Select" in every case clause. Only one of the case clauses will ever be executed. | |
Re: I don't know if this is available in MySql but it is a feature of MS SQL (and in a slightly different form, Access). The COALESCE function can be used in a sql query to replace null values with a defailt value. For example select lastName, firstName, COALESCE(title,'n/a') from table1 … |
The End.