ASP and SQL driving me nuts

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #16
    I am guessing it has to do with the date parameter.
    When you set the type to Date, the parameter expects you to add an object of type DateTime, not a string?
    EDIT: actually the same holds true for all of them, the parameters of type Int, want you to add an object of type Int and not a string.

    Comment

    • Plater
      Recognized Expert Expert
      • Apr 2007
      • 7872

      #17
      Originally posted by BezerkRogue
      What does this error mean?

      BC31029: Method 'Protected Sub Page_Load(sende r As Object, e As System.EventArg s, rDate As Date, Shift As String, HeadCount As Integer, STDHeadCount As Integer, Absent As Short, rTO As Integer, Notes As String, RID As Integer)' cannot handle Event 'Public Event Load(sender As Object, e As System.EventArg s)' because they do not have the same signature.
      it means you accidently deleted something and part of your page_load() function got overriden with the declaration of your other function.
      Straighten out the functions and you should be fine.

      Comment

      • BezerkRogue
        New Member
        • Oct 2007
        • 68

        #18
        Originally posted by Plater
        it means you accidently deleted something and part of your page_load() function got overriden with the declaration of your other function.
        Straighten out the functions and you should be fine.
        Got them straightened out. I have remarked out all of the variables in the sp calls and executed it to see where I get a error. On the headcount variable I get a Object must implement IConvertible. error message. The first two pass fine.

        Is this a bug or is there something that I didn't put in the code?

        Comment

        • Plater
          Recognized Expert Expert
          • Apr 2007
          • 7872

          #19
          strHeadCount is a string yes?
          Convert it to an int with:
          Int.Parse(strHe adCount)

          Comment

          • BezerkRogue
            New Member
            • Oct 2007
            • 68

            #20
            Originally posted by Plater
            strHeadCount is a string yes?
            Convert it to an int with:
            Int.Parse(strHe adCount)

            It didn't like that line. Is there another way to cast a string to an int in VB.Net?

            Comment

            • Plater
              Recognized Expert Expert
              • Apr 2007
              • 7872

              #21
              Originally posted by BezerkRogue
              It didn't like that line. Is there another way to cast a string to an int in VB.Net?
              What's wrong with that line? (other then if the string is empty or contains non-integer chracters it will throw an exception, but you said they were garunteed to contain correct data)
              That and .TryParse() are the first choices for converting a string to an integer.

              Comment

              • BezerkRogue
                New Member
                • Oct 2007
                • 68

                #22
                Originally posted by Plater
                What's wrong with that line? (other then if the string is empty or contains non-integer chracters it will throw an exception, but you said they were garunteed to contain correct data)
                That and .TryParse() are the first choices for converting a string to an integer.

                I put the following line in:

                Int32.Parse(str STDHeadCount) and get this error...

                Conversion from type 'TextBox' to type 'String' is not valid.

                Sigh....another change another error.

                Comment

                • Plater
                  Recognized Expert Expert
                  • Apr 2007
                  • 7872

                  #23
                  strSTDHeadCount is a textbox object then?
                  Use strSTDHeadCount .Text, I thought it was string since you pulled it from the session.

                  That coulda been your trouble with the "." error earlier, if Session.Item("S TDHeadCount") is a textbox then Session.Item("S TDHeadCount").T oString() would come back as like "Forms.Text Box"

                  I would suggest you go back and only store the TEXT in the session, unless you want the whole textbox.

                  Comment

                  • BezerkRogue
                    New Member
                    • Oct 2007
                    • 68

                    #24
                    Originally posted by Plater
                    strSTDHeadCount is a textbox object then?
                    Use strSTDHeadCount .Text, I thought it was string since you pulled it from the session.

                    That coulda been your trouble with the "." error earlier, if Session.Item("S TDHeadCount") is a textbox then Session.Item("S TDHeadCount").T oString() would come back as like "Forms.Text Box"

                    I would suggest you go back and only store the TEXT in the session, unless you want the whole textbox.
                    I set them to Session.Item.Ad d("HeadCount" , txtHeadCount.Te xt) on the sending page and Session.Item("H eadCount").ToSt ring() on the receiving page.

                    I get Input string was not in a correct format messages. I have also tried parsing the variable to int by setting Session.Item("H eadCount") and then int32.Parse(str HeadCount).

                    I'm about ready to tank the whole page and start from scratch.

                    Comment

                    • Plater
                      Recognized Expert Expert
                      • Apr 2007
                      • 7872

                      #25
                      Yeah, I'm scratchin my head now, not sure why it thinks it's a textbox.
                      that's really messed up.

                      Comment

                      • BezerkRogue
                        New Member
                        • Oct 2007
                        • 68

                        #26
                        Originally posted by Plater
                        Yeah, I'm scratchin my head now, not sure why it thinks it's a textbox.
                        that's really messed up.
                        I have an <%@ reference page%> statement in the pages. Do I need that when using sessions or would it help if you saw the code from both pages?

                        Comment

                        • Plater
                          Recognized Expert Expert
                          • Apr 2007
                          • 7872

                          #27
                          Originally posted by BezerkRogue
                          I have an <%@ reference page%> statement in the pages. Do I need that when using sessions or would it help if you saw the code from both pages?
                          Umm....I don't know?
                          My aspx pages start with something like this:
                          Code:
                          <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
                          Then I have the aspx.cs (or for vb aspx.vb) where my backend code goes.
                          Session was just always available to me.

                          Comment

                          • BezerkRogue
                            New Member
                            • Oct 2007
                            • 68

                            #28
                            Originally posted by Plater
                            Umm....I don't know?
                            My aspx pages start with something like this:
                            Code:
                            <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
                            Then I have the aspx.cs (or for vb aspx.vb) where my backend code goes.
                            Session was just always available to me.
                            I might have found my issue. The query in the change page is pulling all of the data fields for the record by one of the fields is not being loaded into the assigned text box.

                            Response.write shows the variable but making the textbox visible shows no data there.

                            Comment

                            • BezerkRogue
                              New Member
                              • Oct 2007
                              • 68

                              #29
                              Originally posted by Plater
                              Umm....I don't know?
                              My aspx pages start with something like this:
                              Code:
                              <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
                              Then I have the aspx.cs (or for vb aspx.vb) where my backend code goes.
                              Session was just always available to me.
                              I finally figured it out. Got it to work correctly and pass all variables in the correct data type. Thanks for the help. Sessions for the win

                              Comment

                              Working...