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

Reputation: -1 Dishonored
Group:
Active Members
Active Posts:
125 (0.14 per day)
Joined:
29-May 12
Profile Views:
1,174
Last Active:
User is offline Apr 20 2014 07:21 PM
Currently:
Offline

Previous Fields

Country:
Who Cares
OS Preference:
Linux
Favorite Browser:
FireFox
Favorite Processor:
AMD
Favorite Gaming Platform:
PC
Your Car:
Subaru
Dream Kudos:
0
Icon   Hypernal has not set their status

Posts I've Made

  1. In Topic: error setting value for jSpinner

    Posted 20 Apr 2014

    View Postg00se, on 20 April 2014 - 07:24 AM, said:

    Quote

    shop.catchValueFromSpinner(shop.java:378)
    
    is what you need to post


    Here:
    price = Integer.parseInt(model.getValueAt(row, 5).toString());
    Posted Image
  2. In Topic: error setting value for jSpinner

    Posted 20 Apr 2014

    Quote

    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.
  3. 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.
    http://msdn.microsof...=vs.110%29.aspx


    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=;"
    
            Try
                conn.CursorLocation = ADODB.CursorLocationEnum.adUseClient
                conn.ConnectionString = connStr
                conn.Open()
    
            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
                .Execute()
            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
                .Open(cmd)
            End With
        End Sub
    
        Public Sub clearRs(ByVal record As ADODB.Recordset)
            If record.State = ADODB.ObjectStateEnum.adStateOpen Then
                record.Close()
            End If
        End Sub
    End Module
    
    
  4. 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") & "')"
    
    setCmd(sql)
    
    


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

    Posted 20 Feb 2014

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

    hi,

    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! :)

My Information

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

Contact Information

E-mail:
Private

Comments

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