Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 7th, 2005, 03:38 AM
Authorized User
 
Join Date: Dec 2004
Location: pune, maharashtra, India.
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to NitinJoshi
Default Ado.net Problem...

<%@ Import Namespace="System.Data.OleDb" %>
    <script runat="server">
    sub Add(Source As Object, e As EventArgs)
    dim sql as string
    sql="insert into info values(@n,@a,@t,@e)"
    dim insCom as new OleDbCommand(sql,OleDbConnection1)
    OleDbDataAdapter1.InsertCommand=InsCom
    OleDbDataAdapter1.Insercommand.Parameters.Add(new OleDbParameter("@n",oledbType.Char,30))
    OleDbDataAdapter1.Insercommand.Parameters("@n").Va lue=TextBox1.text
    OleDbConnection1.open()
    OleDbDataAdapter1.InsertCommand.ExecuteNonQuery()
    OleDbConnection1.Close()
    end sub
    </script>

This is the code which is giving me an error like..
----------------------------------------------------------

Compiler Error Message: BC30451: Name 'OleDbConnection1' is not declared.
http://localhost/Web_dev/Databse_Conne/Info_Add.aspx(7) : error BC30451: Name 'OleDbConnection1' is not declared.

    dim Com as new OleDbCommand(sql,OleDbConnection1)
                                    ~~~~~~~~~~~~~~~~
http://localhost/Web_dev/Databse_Conne/Info_Add.aspx(8) : error BC30451: Name 'OleDbDataAdapter1' is not declared.

    OleDbDataAdapter1.InsertCommand=Com
    ~~~~~~~~~~~~~~~~~
http://localhost/Web_dev/Databse_Conne/Info_Add.aspx(9) : error BC30451: Name 'OleDbDataAdapter1' is not declared.

    OleDbDataAdapter1.Insercommand.Parameters.Add(new OleDbParameter("@n",oledbType.Char,30))
    ~~~~~~~~~~~~~~~~~
http://localhost/Web_dev/Databse_Conne/Info_Add.aspx(10) : error BC30451: Name 'OleDbDataAdapter1' is not declared.

    OleDbDataAdapter1.Insercommand.Parameters("@n").Va lue=TextBox1.text
    ~~~~~~~~~~~~~~~~~
http://localhost/Web_dev/Databse_Conne/Info_Add.aspx(11) : error BC30451: Name 'OleDbConnection1' is not declared.

    OleDbConnection1.open()
    ~~~~~~~~~~~~~~~~
http://localhost/Web_dev/Databse_Conne/Info_Add.aspx(12) : error BC30451: Name 'OleDbDataAdapter1' is not declared.

    OleDbDataAdapter1.InsertCommand.ExecuteNonQuery()
    ~~~~~~~~~~~~~~~~~
http://localhost/Web_dev/Databse_Conne/Info_Add.aspx(13) : error BC30451: Name 'OleDbConnection1' is not declared.

    OleDbConnection1.Close()
     ~~~~~~~~~~~~~~~~~

Any ANswres Pls...

Thanx!!
Reply With Quote
  #2 (permalink)  
Old January 7th, 2005, 05:07 AM
Friend of Wrox
 
Join Date: Dec 2004
Location: Chennai, Tamil nadu, India.
Posts: 307
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Vadivel Send a message via Yahoo to Vadivel
Default

I just had a rough look at the code and ...

1. OleDbDataAdapter OleDbDataAdapter1 = new OleDbDataAdapter(); -- is missing. Similarly connection object is also missing.
2. Couple of places it has been written as OleDbDataAdapter1.Insercommand ---> it should be OleDbDataAdapter1.InsertCommand

Best Regards
Vadivel

MVP ASP/ASP.NET
http://vadivel.thinkingms.com
Reply With Quote
  #3 (permalink)  
Old January 10th, 2005, 04:49 AM
Friend of Wrox
 
Join Date: Feb 2004
Location: Bangalore, Karnataka, India.
Posts: 177
Thanks: 0
Thanked 0 Times in 0 Posts
Default

also declare 'OleDbConnection1' & 'OleDbDataAdapter1' in this scope or in the class scope.



It is not how much we do,
but how much love we put in the doing.

-Mother Theresa
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ADO.Net Problem akhilesh_g ASP.NET 2.0 Professional 2 December 18th, 2007 05:33 AM
how to deal with this problem related with ADO.NET zouky ADO.NET 2 October 8th, 2004 04:30 AM
'like' problem with asp.net/ ado badgolfer Access ASP 2 September 16th, 2004 01:50 PM
ADO.NET Problem lakmaldp ADO.NET 1 July 15th, 2004 01:58 AM
ADO.NET Problem dfb78 Classic ASP Databases 1 June 5th, 2003 05:01 PM



All times are GMT -4. The time now is 01:33 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.