adding in database error

  • (3 Pages)
  • +
  • 1
  • 2
  • 3

38 Replies - 684 Views - Last Post: 03 March 2012 - 10:10 PM Rate Topic: -----

#1 cj777  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 118
  • Joined: 03-March 12

adding in database error

Posted 03 March 2012 - 12:59 AM

hi I have a error like this im trying to add the the text in the textbox with a stored procedure in mysql this is the error: Error 1 Argument not specified for parameter 'remarks' of 'Public Function addcheck(age As Object, height As Object, weight As Object, abdomen As Object, bp As Object, pr As Object, rr As Object, temp As Object, extrimities As Object, heart As Object, lung As Object, skin As Object, meddiagnosis As Object, remarks As Object) As Object'. C:\Users\Christopher\Documents\Visual Studio 2008\Projects\Clinic System\WindowsApplication2\frmcheckup.vb 9 13 WindowsApplication2

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bttadd.Click
        If Me.txtage.Text = "" Or Me.txtheight.Text = "" Or Me.txtweight.Text = "" Or Me.txtabdomen.Text = "" Or Me.txtbp.Text = "" Or Me.txtpr.Text = "" Or Me.txtrr.Text = "" Or Me.txttemp.Text = "" Or txtextrimities.Text = "" Or txtheart.Text = "" Or Me.txtlung.Text Or txtskin.Text = "" Or Me.txtmdiag.Text = "" Or Me.txtremarks.Text = "" Then
            MessageBox.Show("All fields mus not be blank!")
            Exit Sub
        Else
            cls.addcheck(txtage.Text, txtheight.Text, txtweight.Text, txtabdomen.Text, txtbp.Text, txtpr.Text, txtrr.Text, txtextrimities.Text, txtheart.Text, txtlung.Text, txtskin.Text, txtmdiag.Text, txtremarks.Text)

        End If
    End Sub


Is This A Good Question/Topic? 0
  • +

Replies To: adding in database error

#2 nK0de  Icon User is offline

  • Catch me As Exception
  • member icon

Reputation: 204
  • View blog
  • Posts: 823
  • Joined: 21-December 11

Re: adding in database error

Posted 03 March 2012 - 01:17 AM

you're not passing the value of txttemp.Text to addcheck

This post has been edited by nK0de: 03 March 2012 - 01:22 AM

Was This Post Helpful? 1
  • +
  • -

#3 cj777  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 118
  • Joined: 03-March 12

Re: adding in database error

Posted 03 March 2012 - 01:32 AM

View PostnK0de, on 03 March 2012 - 01:17 AM, said:

you're not passing the value of txttemp.Text to addcheck

oh thank you didn't see that must keep an eye on that im just a beginner
Was This Post Helpful? 0
  • +
  • -

#4 cj777  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 118
  • Joined: 03-March 12

Re: adding in database error

Posted 03 March 2012 - 01:44 AM

View PostnK0de, on 03 March 2012 - 01:17 AM, said:

you're not passing the value of txttemp.Text to addcheck

sir can i ask another question it seems like when i press the button it just keep executing what the message box says
Was This Post Helpful? 0
  • +
  • -

#5 nK0de  Icon User is offline

  • Catch me As Exception
  • member icon

Reputation: 204
  • View blog
  • Posts: 823
  • Joined: 21-December 11

Re: adding in database error

Posted 03 March 2012 - 01:53 AM

In your IF ELSE statement you've written, if any of those Textboxes are empty, then show the Message.
So are you sure you're entering values to every Textbox there?
Was This Post Helpful? 0
  • +
  • -

#6 cj777  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 118
  • Joined: 03-March 12

Re: adding in database error

Posted 03 March 2012 - 02:16 AM

View PostnK0de, on 03 March 2012 - 01:53 AM, said:

In your IF ELSE statement you've written, if any of those Textboxes are empty, then show the Message.
So are you sure you're entering values to every Textbox there?

yes sir im sure im putting the right values in it weather if its an integer or a varchar
Was This Post Helpful? 0
  • +
  • -

#7 nK0de  Icon User is offline

  • Catch me As Exception
  • member icon

Reputation: 204
  • View blog
  • Posts: 823
  • Joined: 21-December 11

Re: adding in database error

Posted 03 March 2012 - 02:23 AM

nope, I'm asking whether your filling all the Textboxes. Integer or String values doesn't matter.

btw I noticed this later. Your error message All fields mus not be blank!

first tell me, do you want to display this message,

1. when at least one Textbox is empty? or
2. when all the Textboxes are empty?

Which one do you want to happen?

This post has been edited by nK0de: 03 March 2012 - 02:24 AM

Was This Post Helpful? 0
  • +
  • -

#8 cj777  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 118
  • Joined: 03-March 12

Re: adding in database error

Posted 03 March 2012 - 02:37 AM

View PostnK0de, on 03 March 2012 - 02:23 AM, said:

nope, I'm asking whether your filling all the Textboxes. Integer or String values doesn't matter.

btw I noticed this later. Your error message All fields mus not be blank!

first tell me, do you want to display this message,

1. when at least one Textbox is empty? or
2. when all the Textboxes are empty?

Which one do you want to happen?

i want at least one is blank then the message would show up sir
Was This Post Helpful? 0
  • +
  • -

#9 nK0de  Icon User is offline

  • Catch me As Exception
  • member icon

Reputation: 204
  • View blog
  • Posts: 823
  • Joined: 21-December 11

Re: adding in database error

Posted 03 March 2012 - 02:48 AM

then it means you're not entering input to a Textbox somewhere. Debug and see which one you're missing out on.
Was This Post Helpful? 0
  • +
  • -

#10 cj777  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 118
  • Joined: 03-March 12

Re: adding in database error

Posted 03 March 2012 - 02:50 AM

View PostnK0de, on 03 March 2012 - 02:48 AM, said:

then it means you're not entering input to a Textbox somewhere. Debug and see which one you're missing out on.

but im 100% sure im entering all of it not even a single textbox that is left blank
Was This Post Helpful? 0
  • +
  • -

#11 nK0de  Icon User is offline

  • Catch me As Exception
  • member icon

Reputation: 204
  • View blog
  • Posts: 823
  • Joined: 21-December 11

Re: adding in database error

Posted 03 March 2012 - 03:04 AM

hmm...that's odd. I cannot do much from here. Try this method, IsNullOrWhiteSpace to check whether you have empty Textboxes. Its more efficient than the way your doing now. Here's an example on how to use it on Textboxes.

If String.IsNullOrWhiteSpace(TextBox1.Text)
	MessageBox.Show("Empty textbox")
Else
    MessageBox.Show("Okay")
End If


Try this way and let me know.
Was This Post Helpful? 1
  • +
  • -

#12 cj777  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 118
  • Joined: 03-March 12

Re: adding in database error

Posted 03 March 2012 - 03:30 AM

View PostnK0de, on 03 March 2012 - 03:04 AM, said:

hmm...that's odd. I cannot do much from here. Try this method, IsNullOrWhiteSpace to check whether you have empty Textboxes. Its more efficient than the way your doing now. Here's an example on how to use it on Textboxes.

If String.IsNullOrWhiteSpace(TextBox1.Text)
	MessageBox.Show("Empty textbox")
Else
    MessageBox.Show("Okay")
End If


Try this way and let me know.

sir i tried it but it has a message that looks like this:
Error 1 'isnotnullorwhitespace' is not a member of 'String'. C:\Users\Christopher\Documents\Visual Studio 2008\Projects\Clinic System\WindowsApplication2\frmcheckup.vb 7 12 WindowsApplication2
here is my code oh and i made some changes and put a comment on my last codes here it is:
Public Class frmcheckup
    Dim cls As New Class1
    Dim con As New OleDb.OleDbConnection
    Dim sql As String
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bttadd.Click
        If String.isnotnullorwhitespace(Me.txtage.Text) Then
            MessageBox.Show("Empty textbox")
        Else
            MessageBox.Show("ok")
        End If





        'If Me.txtage.Text = "" Or Me.txtheight.Text = "" Or Me.txtweight.Text = "" Or Me.txtabdomen.Text = "" Or Me.txtbp.Text = "" Or Me.txtpr.Text = "" Or Me.txtrr.Text = "" Or Me.txttemp.Text = "" Or txtextrimities.Text = "" Or txtheart.Text = "" Or Me.txtlung.Text Or txtskin.Text = "" Or Me.txtmdiag.Text = "" Or Me.txtremarks.Text = "" Then
        ' MessageBox.Show("All fields mus not be blank!")

        ' Else
        'cls.addcheck(txtage.Text, txtheight.Text, txtweight.Text, txtabdomen.Text, txtbp.Text, txtpr.Text, txtrr.Text, txttemp.Text, txtextrimities.Text, txtheart.Text, txtlung.Text, txtskin.Text, txtmdiag.Text, txtremarks.Text)
        'Dim cmd As New OleDb.OleDbCommand
        ' cmd.CommandText = sql
        ' cmd.Connection = con
        ' cmd.ExecuteNonQuery()
        ' cmd.Dispose()
        ' MessageBox.Show("Record added")

        '  End If

    End Sub

Was This Post Helpful? 0
  • +
  • -

#13 nK0de  Icon User is offline

  • Catch me As Exception
  • member icon

Reputation: 204
  • View blog
  • Posts: 823
  • Joined: 21-December 11

Re: adding in database error

Posted 03 March 2012 - 03:34 AM

IsNullOrWhiteSpace is a built-in method. You can't just type it in like that. It appears in the IntelliSense.

what's the .NET framework you're using? I'm assuming its not 4. That's why that error occurs.

This post has been edited by nK0de: 03 March 2012 - 03:45 AM

Was This Post Helpful? 0
  • +
  • -

#14 cj777  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 118
  • Joined: 03-March 12

Re: adding in database error

Posted 03 March 2012 - 03:40 AM

View PostnK0de, on 03 March 2012 - 03:34 AM, said:

IsNullOrWhiteSpace is a built-in method. You can't just type it in like that. It appears in the IntelliSense.

what's the .NET framework you're using? I'm assuming its not 4. That's why that error occurs.

If you are okay with it, you can attach your project here so that I can take a look at it.

im using 2008 express edition for vb.net and sql management studio express for my database sir
Was This Post Helpful? 0
  • +
  • -

#15 nK0de  Icon User is offline

  • Catch me As Exception
  • member icon

Reputation: 204
  • View blog
  • Posts: 823
  • Joined: 21-December 11

Re: adding in database error

Posted 03 March 2012 - 03:44 AM

ah then like I said it can't be .NET framework 4. That method comes with it so that's why the error occurred. I guess we don't have a choice but to switch to your old way of checking Textboxes. Although its hard to say anything more to do from here. If you are okay with it, you can attach your project here so that I can take a look at it.
Was This Post Helpful? 0
  • +
  • -

  • (3 Pages)
  • +
  • 1
  • 2
  • 3