1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Help Needed

Discussion in 'C#' started by AhLam, Dec 13, 2005.

  1. #1
    Yo guys.I'm stuck wif tis error for quite some time already.Did all the searching through aspfaq etc but still cant solve tis error

    Error Type:
    Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
    [Microsoft][ODBC Driver Manager] Invalid string or buffer length

    Wads the prob.Btw attached some codes.Tink the error happen whenever the update statement is triggered.


    <!--#include file="../../connection/sql_connection.asp"-->

    <!--#include file="replace_function.asp"-->
    <%'Edit Media Processing

    p_Cat = Request.Form("Category")
    p_mCat = Request.Form("mCategory")
    p_Type = Request.Form("Media_Type")
    p_Loc = Request.Form("Location")
    p_Ref = Trim(Request.Form("Media_Ref_No"))
    p_Title = Trim(Request.Form("Media_Title"))
    p_CodeNo = Trim(Request.Form("Code_No"))
    p_Author = Trim(Request.Form("Author"))
    p_Publisher = Trim(Request.Form("Publisher"))
    p_Remarks = Trim(Request.Form("Remarks"))
    p_Project_No = Trim(Request.Form("Project_No"))
    p_Status = Trim(Request.Form("Status"))
    p_txtCat = Trim(Request.Form("txtCategory"))
    p_txtmCat = Trim(Request.Form("txtmCategory"))
    p_txtType = Trim(Request.Form("txtMedia_Type"))
    p_txtLoc = Trim(Request.Form("txtLocation"))
    edit_Ref = Request.QueryString("edit_Ref")


    If Request.Form ("btnClick") = "go" Then

    Response.Redirect ("edit_media.asp?p_Cat=" & p_Cat & "&p_Type=" & p_Type _
    & "&p_Loc=" & p_Loc & "&p_Ref=" & p_Ref & "&p_Title=" & p_Title _
    & "&p_CodeNo=" & p_CodeNo & "&p_Author=" & p_Author & "&p_Publisher=" _
    & p_Publisher & "&p_Remarks=" & p_Remarks & "&p_Project_No=" & p_Project_No & "&p_Status=" & p_Status & "&p_txtCat=" & p_txtCat & "&p_txtmCat=" & p_txtmCat _
    & "&p_txtType=" & p_txtType & "&p_txtLoc=" & p_txtLoc & "&edit_Ref=" & edit_Ref _
    & "&p_Editing=0")

    ElseIf Request.Form ("btnClick") = "edit" Then

    Dim rs1, SQLA, SQLB, SQLC, SQLD
    Dim blnEditItem, blnRefExist, strStatus

    p_Ref = replace_fn(p_Ref, "!amp", "&")
    p_Title = replace_fn(p_Title, "!amp", "&")
    p_CodeNo = replace_fn(p_CodeNo, "!amp", "&")
    p_Author = replace_fn(p_Author, "!amp", "&")
    p_Publisher = replace_fn(p_Publisher, "!amp", "&")
    p_Remarks = replace_fn(p_Remarks, "!amp", "&")
    p_Project_No = replace_fn(p_Project_No, "!amp", "&")
    p_Status = replace_fn(p_Status, "!amp", "&")
    p_txtCat = replace_fn(p_txtCat, "!amp", "&")
    p_txtmCat = replace_fn(p_txtmCat, "!amp", "&")
    p_txtType = replace_fn(p_txtType, "!amp", "&")
    p_txtLoc = replace_fn(p_txtLoc, "!amp", "&")

    SQLA = "SELECT * FROM Media_Record WHERE Media_Ref_No='" & edit_Ref & "'"
    SQLB = "SELECT * FROM Media_Record WHERE Media_Ref_No='" & p_Ref & "'"
    SQLC = "SELECT Media_Ref_No FROM Transactions WHERE Media_Ref_No='" & edit_Ref & "'"
    SQLD = "SELECT Media_Ref_No FROM Monthly_Report WHERE Media_Ref_No='" & edit_Ref & "'"
    'open record set
    Set rs1 = Server.CreateObject("ADODB.Recordset")
    SEMrush
    rs1.Open SQLA,con,2,3
    If Not rs1.EOF Then
    blnRefExist = True
    ElseIf rs1.EOF Then
    blnRefExist = False
    End If
    rs1.Close

    If blnRefExist = True Then
    rs1.Open SQLB,con,2,3
    If Not rs1.EOF Then
    If edit_Ref <> p_Ref Then
    blnEditItem = False
    ElseIf edit_Ref = p_Ref Then
    blnEditItem = True
    rs1("Media_Title") = p_Title
    rs1("Code_No") = p_CodeNo
    rs1("Category") = p_txtCat
    rs1("Main_Category") = p_txtmCat
    rs1("Author") = p_Author
    rs1("Publisher") = p_Publisher
    rs1("Location") = p_txtLoc
    rs1("Media_Type") = p_txtType
    rs1("Remarks") = p_Remarks
    rs1("Project_No") = p_Project_No
    rs1("Status") = p_Status
    rs1.Update()
    strStatus = rs1("Status")
    End If
    ElseIf rs1.EOF Then
    rs1.Close
    blnEditItem = True
    rs1.Open SQLA,con,2,3
    rs1("Media_Ref_No") = UCase(p_Ref)
    rs1("Media_Title") = p_Title
    rs1("Code_No") = p_CodeNo
    rs1("Category") = p_txtCat
    rs1("Main_Category") = p_txtCat
    rs1("Author") = p_Author
    rs1("Publisher") = p_Publisher
    rs1("Status") = P-Status
    rs1("Location") = p_txtLoc
    rs1("Media_Type") = p_txtType
    rs1("Remarks") = p_Remarks
    rs1.Update()
    strStatus = rs1("Status")
    rs1.Close

    rs1.Open SQLC,con,2,3
    Do While Not rs1.EOF
    rs1("Media_Ref_No") = UCase(p_Ref)
    rs1.Update()
    rs1.MoveNext
    Loop
    rs1.Close

    rs1.Open SQLD,con,2,3
    Do While Not rs1.EOF
    rs1("Media_Ref_No") = UCase(p_Ref)
    rs1.Update()
    rs1.MoveNext
    Loop
    End If
    rs1.Close
    End If
    Set rs1 = Nothing

    %>
     
    AhLam, Dec 13, 2005 IP
    SEMrush