Advertisement

08.04.2008 at 06:04AM PDT, ID: 23618830
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.9

Error on insert - ASP MYSQL

Asked by marcusah in Active Server Pages (ASP)

Tags: , ,

Hi Guyz
I am inserting into a mysql database usiing ASP, I keep getting an error but for the life of me can not see the problem, thought a fresh set of yes might help. If you can assist that would be very helpful. I suspect its something stupid that I am just not seeing, so no rude remarks :)

Here is my code:

******************************************************************************************************************************
<%
'
' Database connection code.
'
' Use rsResult for returning queries.
'

Dim adoCon_news                  'Holds the Database Connection Object
Dim rsResult_news            'Holds the recordset for the records in the database
Dim strSQL_news                'Holds the SQL query to query the database

'Create an ADO connection object.
Set adoCon_news = Server.CreateObject("ADODB.Connection")

' This is the live MySQL database.
adoCon_news.Open "DRIVER={MySQL ODBC 3.51 Driver}; SERVER=localhost; UID=***; PWD=***; DATABASE=***"

' Create the Recordset.
Set rsResult_news = Server.CreateObject( "ADODB.Recordset" )

%>

<!-- #include file="../news_toolbox/includes/dbconn.inc.asp" --> 'included above above

<%

    strsql = "insert into news "
    strsql = strsql + "("
    strsql = strsql + "client_id, "
    strsql = strsql + "title, "
    strsql = strsql + "article, "
    strsql = strsql + "date_added "
    strsql = strsql + ")"
    strsql = strsql + "values "
    strsql = strsql + "("
    strsql = strsql + "'" & request.form("client_id") & "', "
    strsql = strsql + "'" & request.form("article_title") & "', "
    strsql = strsql + "'" & request.form("article_body") & "', "
    strsql = strsql + "now() "
    strsql = strsql + ")"

    rsResult.Open strsql, adocon_news

    response.write "Article Successfully Saved<br>"
    response.write "<a href=press_center_article_admin.asp>Return To Press Center Admin</a>"
%>
************************************************************************************************************************


The page that submits the data is here

************************************************************************************************************************
<!-- #include file="includes/dbconn.inc.asp" -->
<!-- #include file="authorisation/client_id.auth.asp" -->
<!-- #include file="includes/templates_article_add.inc.asp" --> 'this is below

*********************************************************************************************************************
<script>
function verify()
{
    var errs = '';
    document.article_add.article_title.value = clean(document.article_add.article_title.value);
    document.article_add.article_body.value = clean(document.article_add.article_body.value);

    if (document.article_add.article_title.value.length == 0)
    {
        errs += 'A title must be provided\n';
    }

    if (document.article_add.article_body.value.length == 0)
    {
        errs += 'Body text must be provided\n';
    }

    if (errs.length != 0)
    {
        alert(errs);
    }
    else
    {
        document.article_add.action = 'article_save.asp';
        document.article_add.submit();
    }
}

function clean(txt)
{
    while (txt.indexOf("'") != -1)
    {
        txt = txt.replace("'","");
    }
    return txt;
}
</script>

<form name=article_add action=javascript:verify() method=post>

<table cellpadding=0 cellspacing=0 align=left border=0>

    <tr>
        <td width="125" valign="top">
            Article Owner
        </td>
        <td>
            <%
            if Authorised_Client_Id = 0 then
                strsql_news = "select client_id, company_name from clients order by company_name"
                rsResult_news.open strsql_news, adocon_news

                if not(rsResult_news.EOF and rsResult_news.BOF) then
                    response.write "<select name=client_id>"
                    while not rsResult_news.EOF
                        Response.Write "<option value=" & rsResult_news("client_id") & ">" & rsResult_news("company_name") & "</option>"
                        rsResult_news.movenext
                    wend
                    response.write "</select>"
                end if
            else
                strsql_news = "select client_id, company_name from clients where client_id = '" & Authorised_Client_Id & "'"
                rsResult_news.open strsql_news, adocon_news

                if not(rsResult_news.EOF and rsResult_news.BOF) then
                    response.write rsResult_news("company_name") & "<input type=hidden name=client_id value=" & rsResult_news("client_id") & ">"
                else
                   'response.redirect "Smeg Off!.asp"
                end if
            end if
            %>
        </td>
    </tr>

    <tr>
        <td valign="top">
            Article Title
        </td>
        <td>
            <input type=text name=article_title id=article_title value="" alt="Article Title" maxlength=255 size="67">
        </td>
    </tr>

    <tr>
        <td valign="top">
            Article Body
        </td>
        <td>
            <textarea rows=10 cols=50 name=article_body id=article_body></textarea>
        </td>
    </tr>

    <tr>
        <td colspan=2 align=right>
            <input type=submit name=submit>
        </td>
    </tr>

    <tr>
        <td colspan=2>
            <a href=../../news toolbox/includes/Press_center_article_admin.asp>Return To Press Center Administration</a>
        </td>
    <tr>
</table>
***************************************************************************************************************************

As I say prob something stupid that I have missed.

Kind regards

Marcus Anderson HitchenStart Free Trial
[+][-]08.04.2008 at 06:10AM PDT, ID: 22152071

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.04.2008 at 06:16AM PDT, ID: 22152108

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.04.2008 at 06:32AM PDT, ID: 22152230

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.04.2008 at 06:42AM PDT, ID: 22152321

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Active Server Pages (ASP)
Tags: ASP, IE (latest), Mozilla, Microsoft VBScript runtime error '800a01a8' Object required: 'rsResult' /admin/news_toolbox/article_save.asp, line 20
Sign Up Now!
Solution Provided By: dosth
Participating Experts: 2
Solution Grade: B
 
 
[+][-]08.04.2008 at 06:48AM PDT, ID: 22152360

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628