CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com

Search:

Type: Posts; User: DataMiser

Search: Search took 0.24 seconds.

  1. Replies
    62
    Views
    40,060

    Re: Error code help needed

    ??

    I do believe he is talking about threads on the message board rather than threading in his programs.


    Yes much better to start a new thread for a new issue.


    You should also mark your...
  2. Replies
    62
    Views
    40,060

    Re: Error code help needed

    There is a little star icon at the bottom left of each post, give that a click on one of the posts you found helpful. This adds a small amount to the rating of the person who posted the info.
  3. Replies
    62
    Views
    40,060

    Re: Error code help needed

    A few notes related to program flow.

    You really should not create the RS object and open it where you are. This will always issue a query on the database even when you are not going to do...
  4. Replies
    62
    Views
    40,060

    Re: Error code help needed

    You are still doing the same thing


    <%
    ' *** Insert new category, name and link colour to the database:

    Dim CategoryRS
    Set CategoryRS = Server.CreateObject("ADODB.Recordset")...
  5. Replies
    62
    Views
    40,060

    Re: Error code help needed

    You are still not doing it like I showed you



    <p class="textEvent">The New Category "
    <% Response.Write Request("TypeName")
    %>
    " Has Been Added To The Database.</p>
    <p...
  6. Replies
    62
    Views
    40,060

    Re: Error code help needed

    Not sure why I did not notice this before


    If Not Trim("TypeName")=""Then


    This will always be true because it is using a literal string. In other words it will never be empty. It will always...
  7. Replies
    62
    Views
    40,060

    Re: Error code help needed

    This piece of code is going to execute no matter what the IF statement result was


    <% Response.Write Request("TypeName")
    %>


    You want to write one of two messages depending on what...
  8. Replies
    62
    Views
    40,060

    Re: Error code help needed

    To get the proper indentation you need to use code tags




    Your Code Here
  9. Replies
    62
    Views
    40,060

    Re: Error code help needed

    Why did you put those *s in there


    <%
    ' *** Insert new category, name and link color to the database:

    Dim CategoryRS
    Set CategoryRS = Server.CreateObject("ADODB.Recordset")
    CategoryRS.Open...
  10. Replies
    62
    Views
    40,060

    Re: Error code help needed

    Look at where your If test is in the code.
    Look at where the .AddNew is in the code

    They are in different places and as a result your If test is not controlling the addnew. If you want the...
  11. Replies
    62
    Views
    40,060

    Re: Error code help needed

    The code you just showed is not the code that adds to the database. That is just a select statement which will only execute if the If condition is false. From what you said before you want to stop...
  12. Replies
    62
    Views
    40,060

    Re: Error code help needed

    Well you are not testing it where you add a record



    Dim CategoryRS
    Set CategoryRS = Server.CreateObject("ADODB.Recordset")
    CategoryRS.Open "SELECT * FROM Type", Connect, 2, 3...
  13. Replies
    62
    Views
    40,060

    Re: Error code help needed

    In that case you just need to follow the code through from the point where the message is displayed by your code and see what it does after that. It is to hard to read it on here without code tags...
  14. Replies
    62
    Views
    40,060

    Re: Error code help needed

    You are trapping for an empty string so a string with one or more space will not be picked up by this.

    If you want to also filter out strings that maybe be nothing but 1 or more spaces as well...
  15. Replies
    62
    Views
    40,060

    Re: Error code help needed

    This is the part that would add a record


    *** Insert new category, name and link color:
    Dim CategoryRS
    Set CategoryRS = Server.CreateObject("ADODB.Recordset")
    CategoryRS.Open "SELECT * FROM...
  16. Replies
    62
    Views
    40,060

    Re: Error code help needed

    I still do not see anything there that would add a record. In fact there is nothing in that last post that would update a record either.

    There are 2 basic ways to add a record to the database
    1:...
  17. Replies
    62
    Views
    40,060

    Re: Error code help needed

    The only code I saw in there that would modify the data is this


    Dim TypeRS
    Query = "SELECT * FROM Type WHERE TypeId=" & Request("TypeId")
    Set TypeRS = Server.CreateObject("ADODB.Recordset")...
  18. Replies
    62
    Views
    40,060

    Re: Error code help needed

    If your goal is to add a record then you are going about it wrong. Select is used to query the database and return a record that is there.

    To add a record you should use the Insert statement and...
  19. Replies
    62
    Views
    40,060

    Re: Error code help needed

    Your If block is all messed up.

    If TypeName="" Then

    'code here will only execute if the typename is empty

    End If

    so if typename is not empty none of the code will execute will execute
  20. Replies
    62
    Views
    40,060

    Re: Error code help needed

    An autonumber field populates automatically when you add a record. You can not select using a numeric field in a where clause without a valid numeric value as part of that clause.

    to test it you...
  21. Replies
    62
    Views
    40,060

    Re: Error code help needed

    Your code checks to see if typename is an empty string if it is then it displays a message if it is not then it executes a select statement which uses iType as a where clause but your script does not...
  22. Replies
    62
    Views
    40,060

    Re: Error code help needed

    You still did not tell us what value is in iType when the code is executed,



    If iType is blank you will get an error

    Also you told us the field in the db contains numeric data but we could...
  23. Replies
    62
    Views
    40,060

    Re: Error code help needed

    Unfortunately you did not answer either of my questions.

    I assume based on the data and field name that TypeID is a numeric field but I can only guess since you did not say.

    You also did not...
  24. Replies
    62
    Views
    40,060

    Re: Error code help needed

    What value is in iType?

    Is TypeID a text field or numeric field in the db?
Results 1 to 24 of 24





Click Here to Expand Forum to Full Width

Featured