4,901 Posted Topics
Re: You are displaying the message, "Connection Established" before you even try to open the connection. I suspect you haven't specified the server name correctly. On my machine (using MS SQL) it is "Server=.\SQLEXPRESS;". When I try with either "Server=localhost" or "Server=(localhost)" I don't get the connection. Try this (with a … | |
Re: The SQL query you want is "DELETE From Student Where MajorName = '" & cmbMajorI.Text & "'" | |
Re: Execute the SQL reader before you check if there are any rows, then step through the records and populate the combobox as in Dim dr As SqlDataReader = SQLcmd.ExecuteReader If dr.HasRows Then Do While dr.Read() cmbName.Items.Add(dr(0)) Loop Else MsgBox("no records") End If | |
Re: You have another table which uses that primary key as a foreign key. If you delete that record then the other table will have an orphan (a record that doesn't point back anywhere). If you are using MS SQL you should be able to set up something called **cascading referential … | |
Re: I found that cramming right up to the exam time just got me extra wound up. What worked for me was to stop preparing a few hours before the exam, show up to the exam site an hour early with a cup of coffee and fine some place close by … | |
Re: Try changing strQuery = "INSERT INTO login (username, password) values (" & txtUser.Text & "', '" & txtPwd.Text & "');" to strQuery = "INSERT INTO login (username, [password]) values ('" & txtUser.Text & "', '" & txtPwd.Text & "')" Looks like you missed the single quote before the first value. … | |
Re: Read the error message. You have to declare the variables and objects with types. Without seeing the form (and properties) I can only assume you created text boxes but left them with the default names (like TextBox1) instead of renaming them (like txtTown). Also, for loop variables you can declare … | |
Re: Name your fields explicitly. If your table has more columns than specified values the insert will fail. The format is INSERT INTO table (fldname1,fldname2,etc) VALUES('value1','value2',etc) Keeping in mind that you don't need the single quotes around numeric fields. Also, by explicitly naming your fields you make the insert independent of … | |
Re: For i As Integer = 1 To 49 Step 2 | |
Re: They say "don't ask the barber if you need a haircut". I think this applies here as the survey was done by an organization that definitely has something to gain by FUDding. In all the years I have been online (at work and at home) I have only (maybe) been … | |
Re: I don't know how you are going to manage a progress bar because the RESTORE command, even if running in a background thread, will not report back the progress of the operation. It will just halt the execution of the thread until it completes. The best you'll do is display … | |
Re: Do a query to select the record with that ID. If it returns a record then you know that it exists. Dim myID As String = "123" query = "SELECT * FROM myTable WHERE company_ID = '" & myID & "'" or even query = "SELECT COUNT(*) FROM myTable WHERE … | |
If I go to a forum (VB.Net in this case) I see a number of threads marked as NEW. I select one thread somewhat down the list and open it. I respond to the question, then redisplay the VB.Net threads. All of the NEW flags have now been removed. Is … | |
Re: @anaconda Your If block will not work as you expect because you are comparing strings (txtMonth.Text) to integers. A date picker is a better method for date selection. | |
Re: Instead of "SELECT Class FROM Class" use "SELECT DISTINCT(Class) FROM Class" | |
Re: I have heard good things about [PC Decrappifier](http://www.pcdecrapifier.com/). It's free for personal use. | |
Re: What database are you using? MS SQL uses the COALESCE(field,value if NULL) function while MS Access uses NZ(field,value if NULL) function. | |
Re: That will tell you whether the machine is on the network but does not tell you if the server is up. Of course, "up" is open to interpretation. If you are running multiple services (FTP, WEB, etc) what can be non-responsive before it is considered not to be up? | |
Re: When I run the following code Private Sub Button_Click(sender As System.Object, e As System.EventArgs) Handles btnCol1.Click For i = 1 To 100 ComboBox1.Items.Add(i) Next End Sub Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click ComboBox1.Items.Clear() For i = 1001 To 1010 ComboBox1.Items.Add(i) Next End Sub I get what … | |
![]() | Re: Unfortunately you have one side that has demonstrated it will do anything to win including obstructing government, voter registration fraud, lying and bankrupting the country. Also unfortunately, you have another side that still thinks it is possible to "play nice" with the other side. Maybe if I explain to him … |
Re: "Password" is a reserved word in SQL. Try mystring = "UPDATE ClientLogIn SET [Password] = '" & PasswordTextBox.Text & "' WHERE ClientID = '" & ClientIDTextBox.Text & "' AND Username = '" & UsernameTextBox.Text & "'" | |
Re: A textbox, by definition, contains text. Also keep in mind that "0" is not equal to 0 The first is a string containing one character, the other is an integer. Everything is stored internally as numbers. The number zero has a value of (you guessed it), 0. However the character … | |
Re: You haven't created the objects. The statement Dim cn As OleDb.OleDbConnection says "allocate a variable named cn that can be used to access an OleDbConnection object. That statement doesn't actually create the object (it isn't pointing at anything). You need to use Dim cn As New OleDb.OleDbConnection This creates the … | |
Re: Here's an example using the Microsoft PUBS sample database. ListView1.Items.Clear() Dim con As New SqlConnection("Server=.\SQLEXPRESS;Database=PUBS;Trusted_Connection=yes;") Dim cmd As New SqlCommand con.Open() cmd.Connection = con cmd.CommandText = "SELECT au_lname,au_fname,zip FROM authors" Dim rdr As SqlDataReader = cmd.ExecuteReader If rdr.HasRows Then Do While rdr.Read() Dim item As New ListViewItem item.Text = rdr("au_lname") … | |
Re: If you go into design view, right click on the listview and select "Edit Columns" you will see the names of all the columns (you can change these names). You can use these names to modify the header text at runtime as in ColumnHeader1.Text = "new header text" If you … | |
Has anyone looked at why I can't attach files to posts using FireFox? I'm currently on FireFox 16.0.2 but I had the same problem with previous versions. | |
Re: The trick is to ensure that a NULL is not returned when you query the table. This can be accomplished using the NZ function. For example SELECT lastName,middleName,firstName FROM mytable might return a NULL for middleName when there is no entry for that field, however SELECT lastName,NZ(middleName,""),firstName FROM mytable will … | |
Re: I wrote something similar while troubleshooting a wireless internet connection this summer. You are welcoome to have a look if it will help. You'll find it [here]( http://static.daniweb.com/images/attachments/3/2012-11-03_10-33_InternetMonitor.zip). It uses three background threads to monitor * The wireless hub (192.168.1.1) * two DNS although you can enter up to three … | |
Re: First suggestion is to declare the parameter types in AddUserFun as Function AddUserFun(user As String, pass As String, acclvl As Integer) As Integer and at the top of this function you can add (for now) Debug.WriteLine("ADD user=" & user & " pass=" & pass & " acclvl=" & acclvl.ToString()) If … | |
Re: Here is a sample of traversing a simple xml structure Dim myxml = <root> <level id="1"> <prop n="PROPERTY" v="VALUE"/> </level> <level id="2"> <prop n="PROPERTY" v="VALUE"/> </level> </root> For Each level In myxml.Elements Debug.WriteLine("id=" & level.@id.ToString) For Each prop In level.Elements Debug.WriteLine("n=" & prop.@n.ToString & " v=" & prop.@v.ToString) Next Next | |
Re: Can you please explain in more detail? | |
Re: The problem is that Microsoft unilaterally decided how you were going to use Windows 8. Metro is clearly designed for tablets with touch screens but just try using a touch screen on a desktop for productivity type work. Tired arms and smudges. They could have given the user the option … | |
Re: My older son is currently living in Stony Brook, Long Island. His house was on a hill (60 feet above sea level) and survived intact. However, he spent the duration of the storm in his office at the University (which also survived intact - 40 feet abouve sea level). He … | |
Re: Once you have eliminated and flagged bad input values, the setting of the rate is simple when you realize that you have several cases. The first case is weight <= 2 kg, the second is weight <= 6, etc. That translates nicely into a select case structure. As long as … | |
Re: >There's a piece of code that disables all texts including special characters, it allows number only. I've been using it. That's of absolutely no help unless you are willing to post the code or a link to it. Also, to everyone who has posted here in the last few days … | |
Re: What are you having a problem with? Is it selecting the data from the database or is it displaying the data? | |
Re: It depends on what database engine you are using. For example, in Access you would do (depending on your system's short-date format) SELECT * FROM myTable WHERE thedate >= #2012-03-07# AND thedate <= #2012-09-15# but in MS SQL you could do SELECT * FROM myTable WHERE thedate BETWEEN '2012-03-07' AND … | |
Re: The above response merely displays the current date and time. To calculate the difference between two date/time values you do the following: txtTimeWorked.Text = DateDiff(DateInterval.Minute, CDate(txtTimeIn.Text), CDate(txtTimeOut.Text)) Assuming that the two fields used in the calculation both contain valid date/time values, it returns the elapsed time in minutes (in the … | |
Re: I wrote an app to monitor a troublesome internet connection. It uses three background threads to monitor three points. I've attached it to this thread and I'd be happy to answer any questions. It's not too complicated and I believe it illustrates some of the things you are trying to … | |
Re: I attached a sample project that implements a command shell inside a Windows form. I hope this helps. | |
Re: Your try/Catch is masking the actual error. Use Catch ex As Exception MsgBox(ex.Message) and post the error message here. If you use Debug.WriteLine(ex.Message) then you can just copy/paste the text | |
Re: Obviously all of your files aren't gone or your system wouldn't be running. How is your system partitioned? Where were the files that you can no longer find? Have you run the disk management console (diskmgmt.msc) to see what the disk info is? What version of Windows are you running? … | |
Re: You could put the due date in one column then calculate the DATEDIFF in days from today. Multiply that by the fine per day. If the result is negative or zero then the book is not overdue and the fine is zero. fine = finerate * Math.Max(0.0, DateDiff(DateInterval.Day, duedate, Now)) … | |
Re: DataGridView1.Rows(3).Cells(1).Style.BackColor = Color.Aqua | |
Re: In the line cmd.CommandText = "INSERT INTO table([Name], [Comment], [emailaddress]) VALUES([txtname], [txtcomment], [txtemail])" you haven't supplied any values for the fields. The actual query needs data as in cmd.CommandText = "INSERT INTO table([Name], [Comment], [emailaddress]) " & VALUES('Fred','some guy','fred@hotmail.com')" or cmd.CommandText = "INSERT INTO table([Name], [Comment], [emailaddress]) VALUES(" & "'" … | |
Re: For under five dollars you can buy a program from [Stardock](http://www.stardock.com/products/start8/) called start8. It can be used to restore the start button and make the Windows desktop the default environment. You can also disable some other annoying Windows 8 features. You can try it for 30 days free. I'm currently … | |
Re: Use InputBox to enter the names as in Private Sub btnAddNames_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAddNames.Click For i As Integer = 0 to 9 names(i) = InputBox("Enter Name") Next End Sub Of course, you'd want to pretty it up a little by checking for blank names, … | |
Re: You can access the rows and columns as follows DataGridView1.Rows(rownum).Cells(colnum).Value | |
Re: If you combine this with your [other thread](http://www.daniweb.com/software-development/vbnet/threads/438760/cmd-command-error) then you could just run unzip.exe in the spawned shell. |
The End.