locked
Why this not working RRS feed

  • Question

  • User507348793 posted

    Im trying to Quere and Access Database i used this for SQLSERVER and it worked "SELECT

    ,[Description]FROM [New2].[dbo].[Item]"; but not with MS Access 

    WHY?

    Friday, August 13, 2010 4:54 AM

Answers

  • User507348793 posted

    I did figure it out thanks but i need this code to be converted


                command.CommandText = "SELECT [BookingNumber], [ItemCode], [ItemPrice], [Status], [ArrivalDate], [DepartureDate] FROM Bookings  WHERE ([ArrivalDate] >= '" + start.ToShortDateString() +
                                            "' OR [ArrivalDate] <= '" + end.ToShortDateString() + "' OR [DepartureDate] <= '" + end.ToShortDateString() +
                                            "' OR  [DepartureDate] >= '" + start.ToShortDateString() + "' AND [Status] != 'C'";


    for access use

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, August 13, 2010 8:24 AM

All replies

  • User-821857111 posted

    Access has no concept of database and owner qualifiers. Remove [New2].[dbo]. so that it reads Select

    ,[Description,[ITem] From.....


    Friday, August 13, 2010 6:48 AM
  • User-837620913 posted

    I don't think Access supports schemas or owners (dbo in your example).

    Try your query without New2 and dbo:

    SELECT * FROM [Item]

    Friday, August 13, 2010 6:49 AM
  • User507348793 posted

    I did figure it out thanks but i need this code to be converted


                command.CommandText = "SELECT [BookingNumber], [ItemCode], [ItemPrice], [Status], [ArrivalDate], [DepartureDate] FROM Bookings  WHERE ([ArrivalDate] >= '" + start.ToShortDateString() +
                                            "' OR [ArrivalDate] <= '" + end.ToShortDateString() + "' OR [DepartureDate] <= '" + end.ToShortDateString() +
                                            "' OR  [DepartureDate] >= '" + start.ToShortDateString() + "' AND [Status] != 'C'";


    for access use

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, August 13, 2010 8:24 AM
  • User507348793 posted

    Does anyone know how to convert this SQLSERVER connString to an  Access DB  string?



    Friday, August 13, 2010 10:13 AM
  • User-821857111 posted

    You should keep things to one question per thread. Your initial question was resolved, so now you should start new threads for separate issues. However, in the meantime, this might help: Migrating from Sql Server to Access in ASP.NET


    Friday, August 13, 2010 10:18 AM