|
1. VB6 is no longer supported; plan to move to a currently supported language.
2. Break the problem into pieces and work them seperately.
For example: find data sets that have more than 1500 records and less than 1500 records, then, using JUST the select statement, run the query to see what is returned.
Also, look into the 'HAVING' clause. You should be able to search for it and find help there.
|
|
|
|
|
|
|
Good advice, Richard
|
|
|
|
|
Richard, isn't a Skype Bruter malicious code?
This message is manufactured from fully recyclable noughts and ones. To recycle this message, please separate into two tidy piles, and take them to your nearest local recycling centre.
Please note that in some areas noughts are always replaced with zeros by law, and many facilities cannot recycle zeroes - in this case, please bury them in your back garden and water frequently.
|
|
|
|
|
|
I have a simple WinForms application with data displayed in a property grid.
Now i am trying to make the application a little more user friendly for a touch screen operation.
I have added simple user control with buttons to simulate a virtual numeric keyboard. The problem is that as soon as i press the buttons on the usercontrol the PropertyValueChanged fires even though the PropertyGrid.ContainsFocus still is true.
This is causing a problem because the input is not yet ready and may still be under/over limit causing the property grid to revert back to its old value.
First i thought it was a problem with the user control stealing focus so i added the following code that i found i a forum to the buttons but the event still fires.
Friend Class UnselectableButton
Inherits Button
' The WS_EX_NOACTIVATE value for dwExStyle prevents foreground
' activation by the system.
Private Const WS_EX_NOACTIVATE As Long = &H8000000L
''' <summary>
''' Set the form style to WS_EX_NOACTIVATE so that it will not get focus.
''' </summary>
Protected Overrides ReadOnly Property CreateParams() As CreateParams
<PermissionSet(SecurityAction.LinkDemand, Name:="FullTrust")>
Get
Dim cp As CreateParams = MyBase.CreateParams
cp.ExStyle = cp.ExStyle Or CInt(Fix(WS_EX_NOACTIVATE))
Return cp
End Get
End Property
Public Sub New()
MyBase.New()
Me.SetStyle(ControlStyles.Selectable, False)
End Sub
Private Sub InitializeComponent()
Me.SuspendLayout()
'
'UnselectableButton
'
Me.TabStop = False
Me.ResumeLayout(False)
End Sub
End Class
Does anyone know how to suppress PropertyValueChanged or any other way around the problem.
|
|
|
|
|
|
gostaria de ciar o id auto_increment e da erro .
me ajude por favor
Sub criatabelaconfiguracoes()
Try
Dim conn As MySqlConnection
Dim strConn As String
Dim cmd As MySqlCommand
strConn = "Server ='" & txtServer.Text & "'; userid = '" & txtUser.Text & "'; password = '" & txtSenha.Text & "';"
'strConn &= "Database = mysql; pooling=false;"
conn = New MySqlConnection(strConn)
cmd = New MySqlCommand("Create Database If Not exists habitacao", conn)
conn.Open()
cmd.ExecuteNonQuery()
conn.ChangeDatabase("habitacao")
Dim sbCmd As New System.Text.StringBuilder
sbCmd.Append("CREATE TABLE configuracoes")
sbCmd.Append("(id INT(10)," & _
"tempolog varchar(255)," & _
"nomesistema varchar(255)," & _
"impressora varchar(255))")
cmd = New MySqlCommand(sbCmd.ToString, conn)
cmd.ExecuteNonQuery()
conn.Close()
criatabelausuario()
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
|
|
|
|
|
You have been a member long enough to know that this is an English language site.
Use the best guess
|
|
|
|
|
That's not a problem related to Visual Basic, but to MySQL!
Hint: id INT(10) creates a "normal" numeric column, without autoincrement. I do not know the MySQL specific syntax for that, the documentation will tell you.
|
|
|
|
|
how to make calculator? in vb.net
|
|
|
|
|
Probably by creating a Windows Forms application. Google can probably find you many samples that will help.
Use the best guess
|
|
|
|
|
<pre lang="vb"><pre lang="vb"><pre lang="vb"> Hi you can check the below code to create a simple calculator with 4 functionalities.
Public Class frmcalculator
Dim Operand1 As Double
Dim Operand2 As Double
Dim [Operator] As String
Private Sub btn1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn1.Click, btn2.Click, btn3.Click, btn4.Click, btn5.Click, btn6.Click, btn7.Click, btn8.Click, btn9.Click, Button2.Click
txtsource.Text = txtsource.Text & sender.text
End Sub
Private Sub btnclear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
txtsource.Text = ""
End Sub
Private Sub btnadd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnadd.Click
Operand1 = Val(txtsource.Text)
txtsource.Text = ""
txtsource.Focus()
[Operator] = "+"
End Sub
Private Sub btndecimal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If InStr(txtsource.Text, ".") > 0 Then
Exit Sub
Else
txtsource.Text = txtsource.Text & "."
End If
End Sub
Private Sub btnequals_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Dim Result As Double
Operand2 = Val(txtsource.Text)
Select Case [Operator]
Case "+"
Result = Operand1 + Operand2
MsgBox(Result.ToString("#,###.00"), MsgBoxStyle.Information, "Result")
txtsource.Text = Result.ToString("#,###.00")
Case "-"
Result = Operand1 - Operand2
MsgBox(Result.ToString("#,###.00"), MsgBoxStyle.Information, "Result")
txtsource.Text = Result.ToString("#,###.00")
Case "/"
Result = Operand1 / Operand2
MsgBox(Result.ToString("#,###.00"), MsgBoxStyle.Information, "Result")
txtsource.Text = Result.ToString("#,###.00")
Case "*"
Result = Operand1 * Operand2
MsgBox(Result.ToString("#,###.00"), MsgBoxStyle.Information, "Result")
txtsource.Text = Result.ToString("#,###.00")
End Select
txtsource.Text = Result.ToString("#,###.00")
End Sub
Private Sub btnminus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnminus.Click
Operand1 = Val(txtsource.Text)
txtsource.Text = ""
txtsource.Focus()
[Operator] = "-"
End Sub
Private Sub btnmultiply_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnmultiply.Click
Operand1 = Val(txtsource.Text)
txtsource.Text = ""
txtsource.Focus()
[Operator] = "*"
End Sub
Private Sub btndivide_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btndivide.Click
Operand1 = Val(txtsource.Text)
txtsource.Text = ""
txtsource.Focus()
[Operator] = "/"
End Sub
Private Sub btnaddminus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
txtsource.Text = -1 * txtsource.Text
End Sub
Private Sub btnx_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnx.Click
Dim convert As Single
If txtsource.Text <> 0 Then
convert = 1 / Val(txtsource.Text)
txtsource.Text = convert
End If
End Sub
Private Sub frmcalculator_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
If e.KeyCode = Keys.Enter Then
Call btnequals_Click(sender, e)
End If
End Sub
Private Sub frmcalculator_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub GroupBox1_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GroupBox1.Enter
End Sub
End Class
|
|
|
|
|
Try something and then post issues here.
|
|
|
|
|
I really need help with this.
1. I have a excel file with columns with text and some with only the date in it (07/16/2013). This date can be in more than one row.
2. I then have a form where I can display all the info in the form (Eg like if I choose server, it will show me that server info on the form with all the other details that goes with it.
I get the info form my excel file.
3. I then have a button to search for info eg Server names, it then make a data grid view and show my all the servers that start with eg. Prasa.
4. Now my problem is I cannot get it to search for a date. I need help with this.
Here is my main code and my button date search code.
Is the a sample of this or can someone help me with this.
Imports System.Data.OleDb
Public Class Tapes_info
Private dtGlobal As New DataTable
Private Sub Tapes_info_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
dtGlobal.Clear()
Using cn As New OleDb.OleDbConnection
Dim Builder As New OleDbConnectionStringBuilder With {.DataSource = IO.Path.Combine(Application.StartupPath, "Backuptapes.xls"), .Provider = "Microsoft.ACE.OLEDB.12.0"}
Builder.Add("Extended Properties", "Excel 12.0; IMEX=1;HDR=No;")
cn.ConnectionString = Builder.ConnectionString
cn.Open()
Using cmd As OleDbCommand = New OleDbCommand With {.Connection = cn}
cmd.CommandText = "SELECT TOP 5130 F1 As Tapes, F2 As Containere, F3 as ContainerRef, F4 as DateOut FROM [Tapese$]"
Dim dr As System.Data.IDataReader = cmd.ExecuteReader
dtGlobal.Load(dr)
LstTape.DisplayMember = "Tapes"
LstTape.DataSource = dtGlobal
txtContainer.DataBindings.Add("Text", dtGlobal, "Containere")
txtContainerRef.DataBindings.Add("Text", dtGlobal, "ContainerRef")
txtDateOut.DataBindings.Add("Text", dtGlobal, "Dateout")
End Using
End Using
End Sub
Private Sub BtnSearchDateOut_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnSearchDateOut.Click
For i As Integer = 0 To dtGlobal.Rows.Count - 1
If IsDBNull(dtGlobal.Rows(i)("Dateout")) Then
dtGlobal.Rows(i)("Dateout") = ""
End If
Next
Dim query = From item In dtGlobal.AsEnumerable() Where item.Field(Of String)("Dateout").StartsWith(txtSearchDateOut.Text) Select item
If query.Count > 0 Then
Dim newDT As DataTable = query.CopyToDataTable()
MsgBox(newDT.Rows.Count.ToString() & " Date out found.")
Dim frm As New Form()
Dim dgv As New DataGridView()
dgv.DataSource = newDT
dgv.Refresh()
frm.Controls.Add(dgv)
dgv.Dock = DockStyle.Fill
frm.Size = New Size(1400, 700)
frm.Show()
Else
MsgBox("There is no Date for this found.")
End If
|
|
|
|
|
2 main issues, using excel as a data store (probably not going to change) and the main issue is that you are storing your dates as string/text. ALWAYS use the date or datetime data type for storing and manipulating date.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Mycroft Holmes wrote: you are storing your dates as string/text I've lost count of the number of questions with that 'feature'. I wonder who is teaching these people?
Use the best guess
|
|
|
|
|
To be honest I don't think anyone is teaching them, I remember when I was learning I stored dates as text, I then discovered the data type, that was in the 80s mind you. If these people are just diving in to build some hobby app without ever having done any reading I would expect these questions.
The seriously frightening thing is they may have been taught!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Yes I do not have any training in vb.net. I am trying to lean it on my own, as the courses here in south Africa is very expensive.
Where must the date be not string/text, I don’t understand where I should change it.
|
|
|
|
|
I have a web-server and my database is MySQL in Xampp so I want to use VB 2008 to connect MySQL in XAMPP 1.7 by internet online ..help me please
|
|
|
|
|
manoph wrote: I have a web-server and my database is MySQL in Xampp so I want to use VB 2008 to connect MySQL in XAMPP 1.7 by internet online I assume that you're talking about an ASP.NET application, not a WinForm app. Wouldn't XAMPP be more suited for PHP-development, as opposed to hosting ASP.NET apps?
You'll need a webserver that's capable of serving ASP.NET pages; those will connect to the MySQL in your XAMPP stack. The webserver needs to be accessible from outside of the network; meaning that you'll need to setup your firewall and router to accept incoming traffic. If you're doing this on an ADSL-line from home, look at the NAT-settings of the router.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Thanks you for your advise
|
|
|
|
|
You're welcome
|
|
|
|
|
Hi,
I am trying to generate a report with Crystal Report.
But my report is blank
My code is ...
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
OpenConnection()
qry = "SELECT * FROM customer"
dbcommand.Connection = DbConn.conn
dbcommand.CommandText = qry
dbadapter.SelectCommand = dbcommand
dbadapter.Fill(stdata, "Customer")
Dim objRpt As New CustomerRpt
objRpt.SetDataSource(stdata.Tables("Customer"))
rptViewer.ReportSource = objRpt
rptViewer.RefreshReport()
Catch ex As Exception
MsgBox(ex.Message)
Finally
CloseConnection()
End Try
End Sub
The Customer table has 7 rows.
I am using mysql database and vb.net 2010.
One more thing I would like to inform you that, while designing the CrystalReport, I did not find any field in CrystalReport --> Field Explorer --> Database fields
|
|
|
|
|