Wrox Programmer Forums
|
VB.NET General VB.NET discussions for issues that don't fall into other VB.NET forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 10th, 2007, 09:45 AM
Registered User
 
Join Date: Aug 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Error in row

Iam not exactly sure if this belongs here but ... here goes please redirect me if Iam posting in the wrong spot.

    dim objRecord2
    objRecord2 = Server.CreateObject("ADODB.Recordset")
    objRecord2.ActiveConnection = cDBSTRING
    objRecord2.CursorType = 3
    objRecord2.LockType = 3
    objRecord2.Source = "Contacts"
    objRecord2.Open("SELECT * FROM Contacts WHERE FirstName ='" & FirstName & "' AND LastName ='" & LastName & "' AND AddressLine1 ='" & Address & "'")
    'objRecord2.Filter="FirstName ='" & FirstName & "' AND LastName ='" & LastName & "' AND AddressLine1 ='" & Address & "'"

dim null2 as system.dbnull

If objRecord2.RecordCount = 0 Then

response.write("New Record")

    'This is for COMPLETELY NEW REGISTRATIONS
    dim objNewContact
    objNewContact = Server.CreateObject("ADODB.Recordset")
    objNewContact.ActiveConnection = cDBSTRING
    objNewContact.CursorType = 3
    objNewContact.LockType = 3
    objNewContact.Source = "Contacts"
    objNewContact.Open
    objNewContact.AddNew

       objNewContact("EmailName") = objToken.User.UserName
    objNewContact("FirstName") = objToken.User.Addresses.DefaultItem.FirstName
    objNewContact("LastName") = objToken.User.Addresses.DefaultItem.LastName
    objNewContact("Suffix") = " "
    objNewContact("CompanyName") = " "
    objNewContact("AddressNote") = " "
    objNewContact("AddressLine1") = objToken.User.Addresses.DefaultItem.Address1
    if objToken.User.Addresses.DefaultItem.Address2 = "" then
        objNewContact("AddressLine2") = " "
    else
        objNewContact("AddressLine2") = objToken.User.Addresses.DefaultItem.Address2
    end if
    objNewContact("State") = objToken.User.Addresses.DefaultItem.Province
    objNewContact("City") = objToken.User.Addresses.DefaultItem.City
    objNewContact("ZipCode") = objToken.User.Addresses.DefaultItem.PostalCode
    objNewContact("Zip4") = " "
    objNewContact("Foreign ZipCode") = " "
    objNewContact("Country") = objCustomer.BillAddr.CountryCode
    objNewContact("PrimaryPhoneType") = " "
    objNewContact("PrimaryPhoneExt") = " "
    objNewContact("Fax") = " "
    objNewContact("ReferredBy") = 1
    objNewContact("Gift") = False
    objNewContact("GiftFromID") = 0
    objNewContact("Notes") = ""
    objNewContact("MembershipStatus") = " "
    objNewContact("Issues_Remain") = "0"
    objNewContact("Clergy") = " "
    objNewContact("MemberCode") = "Member"
    objNewContact("MemberCodeDate") = NewExpireDate2
    objNewContact("Joined?") = False
    objNewContact("DateJoined") = NewExpireDate2
    objNewContact("DateUpdated") = NewExpireDate2
    objNewContact("Renewed/Rejoined") = " "
    objNewContact("DateRenewed") = NewExpireDate2
    objNewContact("FOCUS") = " "
    objNewContact("Multiple") = null2
    objNewContact("MultipleExp") = null2
    objNewContact("DoNotSellName") = False
    objNewContact("TrackingCode") = " "
    objNewContact("External ID") = null2
    objNewContact("SLID Number") = null2
    objNewContact("SourceList") = " "
    objNewContact("FOCUSEmployeeID") = "0"
    objNewContact("MonthlyDonor") = False
    objNewContact("TempID") = "0"
    objNewContact("NameOrigination") = " "
    objNewContact("DateLastServedIS") = NewExpireDate2

    objNewContact.Update <----- ERROR
        objNewContact.Close
    objNewContact = Nothing

Else


    'This is for existing contacts that are being updated.

    'Connection to the database -FK
    dim objEditContact = Server.CreateObject("ADODB.Recordset")
    objEditContact.ActiveConnection = cDBSTRING
    objEditContact.CursorType = 3
    objEditContact.LockType = 3
    objEditContact.Source = "Contacts"
       objEditContact.Open

       objEditContact("EmailName") = objToken.User.UserName
    objEditContact("FirstName") = objToken.User.Addresses.DefaultItem.FirstName
    objEditContact("LastName") = objToken.User.Addresses.DefaultItem.LastName
    objEditContact("Suffix") = " "
    objEditContact("CompanyName") = " "
    objEditContact("AddressNote") = " "
    objEditContact("AddressLine1") = objToken.User.Addresses.DefaultItem.Address1
    if objToken.User.Addresses.DefaultItem.Address2 = "" then
        objEditContact("AddressLine2") = " "
    else
        objEditContact("AddressLine2") = objToken.User.Addresses.DefaultItem.Address2
    end if
    objEditContact("State") = objToken.User.Addresses.DefaultItem.Province
    objEditContact("City") = objToken.User.Addresses.DefaultItem.City
    objEditContact("ZipCode") = objToken.User.Addresses.DefaultItem.PostalCode
    objEditContact("Zip4") = " "
    objEditContact("Foreign ZipCode") = " "
    objEditContact("Country") = objCustomer.BillAddr.CountryCode
    objEditContact("PrimaryPhoneType") = " "
    objEditContact("PrimaryPhoneExt") = " "
    objEditContact("Fax") = " "
    objEditContact("ReferredBy") = 1
    objEditContact("Gift") = False
    objEditContact("GiftFromID") = 0
    objEditContact("Notes") = ""
    objEditContact("MembershipStatus") = " "
    objEditContact("Issues_Remain") = "0"
    objEditContact("Clergy") = " "
    objEditContact("MemberCode") = "Member"
    objEditContact("MemberCodeDate") = NewExpireDate2
    objEditContact("Joined?") = False
    objEditContact("DateJoined") = NewExpireDate2
    objEditContact("DateUpdated") = NewExpireDate2
    objEditContact("Renewed/Rejoined") = " "
    objEditContact("DateRenewed") = NewExpireDate2
    objEditContact("FOCUS") = " "
    objEditContact("Multiple") = null2
    objEditContact("MultipleExp") = null2
    objEditContact("DoNotSellName") = False
    objEditContact("TrackingCode") = " "
    objEditContact("External ID") = null2
    objEditContact("SLID Number") = null2
    objEditContact("SourceList") = " "
    objEditContact("FOCUSEmployeeID") = "0"
    objEditContact("MonthlyDonor") = False
    objEditContact("TempID") = "0"
    objEditContact("NameOrigination") = " "
    objEditContact("DateLastServedIS") = NewExpireDate2

       objEditContact.Update
    objEditContact = Nothing

End If

    objRecord2.Close
    objRecord2 = Nothing


That right there is my whole if statement and Iam getting an "Error in Row" message ... Iam using an Access database and ADO to connect to it. If you can help by all means do so! Thanks for any responses!

 
Old August 10th, 2007, 10:42 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

hi there.. this looks like vb 6 code.. it should be in a vb forum, not in .net...

anyway.. this is a valid name for a field?? (Joined?)

if you try to do it field by field it will be easier to see the offending field...

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========
 
Old August 10th, 2007, 12:18 PM
Registered User
 
Join Date: Aug 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You know whats kind of funny ... I just figured this out, and it has nothing to do with my code ... the error occurs because of a field that is generated with in Access... so we gotta go whoop up on our db guy haha, yes to answer your question "Joined?" is the proper field name. Thanks alot for looking at this =) always helps to have an extra set of eyes.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Scrollbar in row of Datagrid Except Header Row Theone84 ASP.NET 2.0 Professional 0 August 11th, 2008 12:10 AM
To retrieve a row by giving row number prad_a MySQL 1 March 22nd, 2007 11:20 PM
Read a column and Search Row by Row in another col AyatKh Excel VBA 2 January 26th, 2005 12:02 PM
Manage data row by row in datagrid Dragonist Classic ASP Databases 5 July 29th, 2004 04:17 AM
One Row in DataGrid error petersonginae VB.NET 2002/2003 Basics 2 July 14th, 2004 05:14 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.