Hypernal's Profile User Rating: -----

Reputation: -1 Dishonored
Active Members
Active Posts:
124 (0.18 per day)
29-May 12
Profile Views:
Last Active:
User is offline Today, 08:39 AM

Previous Fields

Who Cares
OS Preference:
Favorite Browser:
Favorite Processor:
Favorite Gaming Platform:
Your Car:
Dream Kudos:
Icon   Hypernal has not set their status

Posts I've Made

  1. In Topic: error setting value for jSpinner

    Posted 20 Apr 2014


    Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: -1
    at java.util.Vector.elementData(Vector.java:730)
    at java.util.Vector.elementAt(Vector.java:473)
    at javax.swing.table.DefaultTableModel.getValueAt(DefaultTableModel.java:649)
    at shop.catchValueFromSpinner(shop.java:378)
    at shop.access$100(shop.java:22)
    at shop$3.stateChanged(shop.java:153)
    at javax.swing.JSpinner.fireStateChanged(JSpinner.java:457)
    at javax.swing.JSpinner$ModelListener.stateChanged(JSpinner.java:385)
    at javax.swing.AbstractSpinnerModel.fireStateChanged(AbstractSpinnerModel.java:119)
    at javax.swing.SpinnerNumberModel.setValue(SpinnerNumberModel.java:447)
    at javax.swing.JSpinner.setValue(JSpinner.java:353)
    at shop.reset(shop.java:77)
    at shop.jButton1ActionPerformed(shop.java:320)
    at shop.access$200(shop.java:22)

    Here's the line 153 (shop$3.stateChanged(shop.java:153)):
    Posted Image

    It's all greyed-out and can't be edited.
  2. In Topic: Insert DateTimePicker value to sql

    Posted 11 Mar 2014

    View Postmodi123_1, on 11 March 2014 - 12:36 PM, said:

    No.. that is not a parametrized query.

    Read up on MSDN.

    Thanks! But I don't know how to add parameters using the connection settings supplied to us by our prof.

    Module Module1
        Public conn As New ADODB.Connection
        Public cmd As New ADODB.Command
        Public rs As New ADODB.Recordset
        Public sql As String
        Public Sub connectDB()
            Dim connStr As String
            Dim driver As String = "{MySQL ODBC 3.51 Driver}"
            Dim server As String = "localhost"
            Dim db As String = "inventory"
            Dim user As String = "root"
            Dim pwd As String = ""
            Dim port As String = "3306"
            Dim opt As String = "3"
            connStr = "DRIVER=" & driver & ";SERVER=" & server & ";DATABASE=" & db & ";UID=" & user & ";PWD=" & pwd & ";PORT=" & port & ";OPTION=" & opt & ";STMT=;"
                conn.CursorLocation = ADODB.CursorLocationEnum.adUseClient
                conn.ConnectionString = connStr
            Catch ex As Exception
                MsgBox("Error: " & vbCrLf & ex.ToString, MsgBoxStyle.Critical, "Error")
            End Try
        End Sub
        Public Sub setCmd(ByVal sql As String)
            cmd = New ADODB.Command
            With cmd
                .ActiveConnection = conn
                .CommandText = sql
            End With
        End Sub
        Public Sub setRs()
            rs = New ADODB.Recordset
            With rs
                .ActiveConnection = conn
                .CursorLocation = ADODB.CursorLocationEnum.adUseClient
                .CursorType = ADODB.CursorTypeEnum.adOpenKeyset
                .LockType = ADODB.LockTypeEnum.adLockOptimistic
            End With
        End Sub
        Public Sub clearRs(ByVal record As ADODB.Recordset)
            If record.State = ADODB.ObjectStateEnum.adStateOpen Then
            End If
        End Sub
    End Module
  3. In Topic: Insert DateTimePicker value to sql

    Posted 11 Mar 2014

    View Postmodi123_1, on 11 March 2014 - 12:27 PM, said:

    Sure.. let a parametrized query do the heavy lifting for you.

    Is this right?
    Dim dMyDate As DateTime = dtDate.Value
    sql = "INSERT INTO receipts_desc_tbl VALUES(NULL, '" & lblTrans2.Text & "', '" & cmbItem.Text & "', '" & numQty.Value & "', '" & numQty.Value & "' * '" & rs.Fields("selling_price").Value & "', '" & txtSoldto.Text & "', '" & dMyDate.ToString("YYYY MM DD") & "')"

    However, it stores 0000-00-00 in my datebase :(
  4. In Topic: Validating MaskedTextBox Integer Length

    Posted 20 Feb 2014

    View Postraziel_, on 20 February 2014 - 01:51 AM, said:


    where is this code? what method? also do not use On Error Resume Next. you should avoid using go to and specially on error resume next. what this do is that if error occurs the code do not stop and just resume with the lines below.

    good luck

    It's the mtbPin.TextLength = 15..

    Anyways, I just found a solution which is mtbPin.MaskCompleted :)

    Thanks anyways! :)
  5. In Topic: Sales receipt number - database

    Posted 19 Feb 2014


    Yup, that's what exactly I'm looking for before.. However I realized that I don't need to put A_I in receipt_no since
    there are multiple items per receipt_no:
    receipt number | Line number | SKU 
    123                 1           987
    123                 2           456
    123                 3           345
    111                 1           135
    111                 2           888

    If I put A_I on receipt_no it would be 123,124,125,126,127, etc.. But if not A_I then I would have to put the receipt_no manually, right? I can't think of a proper index for receipt_no..

My Information

Member Title:
D.I.C Head
Age Unknown
Birthday Unknown

Contact Information



Hypernal has no profile comments yet. Why not say hello?