Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3
This is the forum to discuss the Wrox book Beginning ASP.NET 3.5: In C# and VB by Imar Spaanjaars; ISBN: 9780470187593
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 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 July 22nd, 2008, 07:56 AM
Authorized User
 
Join Date: Jun 2008
Location: , , .
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to workidoo
Default LINQ Error ? Chapter 13

Hello everyone,

I have a small problem which I do not get the right on. Has just started with LINQ and tested the first exercise, but I got comp. error whole the time. This is how my code look (I even tryed whit Imars code too but it dosent work):

 Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Using myDataContext As New PlanetWroxDataContext()
            Dim allReviews = From review In myDataContext.Reviews _
                     Where review.Authorized = True _
                     Order By review.CreateDateTime Descending _
                     Select review

            GridView1.DataSource = allReviews
            GridView1.DataBind()
        End Using

I got the following error:
BC30516: Overload resolution failed because no accessible 'New' accepts this number of arguments.

Row 5, whitch is:
Using myDataContext As New PlanetWroxDataContext()

http://www.workidoo.com
__________________
http://www.workidoo.com
Reply With Quote
  #2 (permalink)  
Old July 22nd, 2008, 08:15 AM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Quote:
quote:I even tryed whit Imars code too but it dosent work
It doesn't? Also not when you download the code from the Wrox website and directly open the site? That should always work....

Anyway, sounds like your PlanetWroxDataContext class is messed up. Try deleting the file, add it again in the App_Code folder and drag the necessary tables on the design surface. Save and close the diagram and try again.

Additionally, make sure you have the right Imports statements at the top of your file to enable LINQ queries.

Cheers,

Imar


---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.
Reply With Quote
  #3 (permalink)  
Old July 22nd, 2008, 08:40 AM
Authorized User
 
Join Date: Jun 2008
Location: , , .
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to workidoo
Default

Hi again,

Nope it dosent work, I just did as you told med but i got same error. As soon as I write Using myDataContext the myDataContext get blue underline like something is wrong. Even when I write From review In myDataContext.Reviews it happends the same for myDataContext.

You wrote "Additionally, make sure you have the right Imports statements at the top of your file to enable LINQ queries." How can I se that?

This is how my planetwrox.designer.vb looks like:

'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:2.0.50727.1433
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------

Option Strict On
Option Explicit On

Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Data.Linq
Imports System.Data.Linq.Mapping
Imports System.Linq
Imports System.Linq.Expressions
Imports System.Reflection


Partial Public Class PlanetWroxDataContext
    Inherits System.Data.Linq.DataContext

    Private Shared mappingSource As System.Data.Linq.Mapping.MappingSource = New AttributeMappingSource

#Region "Extensibility Method Definitions"
    Partial Private Sub OnCreated()
    End Sub
#End Region

    Public Sub New(ByVal connection As String)
        MyBase.New(connection, mappingSource)
        OnCreated()
    End Sub

    Public Sub New(ByVal connection As System.Data.IDbConnection)
        MyBase.New(connection, mappingSource)
        OnCreated()
    End Sub

    Public Sub New(ByVal connection As String, ByVal mappingSource As System.Data.Linq.Mapping.MappingSource)
        MyBase.New(connection, mappingSource)
        OnCreated()
    End Sub

    Public Sub New(ByVal connection As System.Data.IDbConnection, ByVal mappingSource As System.Data.Linq.Mapping.MappingSource)
        MyBase.New(connection, mappingSource)
        OnCreated()
    End Sub
End Class

Dose something missing there?

http://www.workidoo.com
Reply With Quote
  #4 (permalink)  
Old July 22nd, 2008, 09:37 AM
Authorized User
 
Join Date: Jun 2008
Location: , , .
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to workidoo
Default

It works now do not ask me why, but it works hehehe...

http://www.workidoo.com
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
Database error in Chapter 13, C# version Judy BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 0 July 25th, 2007 09:30 AM
chapter 13 columnid=Null error bwoll BOOK: Beginning Access 2003 VBA 0 June 7th, 2007 03:53 PM



All times are GMT -4. The time now is 06:23 PM.


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