Howto: Convert sample SQL dB code to Access dB code?


In reference to the book: ASP.NET Web Matrix Starter Kit (ISBN: 0-7356-1856-9)
Chapter 14 – Creating a Web-Based Calendar.
The sample code works great when using an SQL server dB. However Web Matrix allows us to use an Access dB as well.
My question is how do I convert the code found on page 275 to work with an Access dB?
I have got the rest of the sample code in this chapter to work using Access, but I am not familiar with the proper way to convert this code:

Sub DisplayAppointments(dateToDisplay As DateTime)
labelSelectedDate.Text = dateToDisplay
SQLDataSourceControl1.Parameters("@startdate") = dateToDisplay
SQLDataSourceControl1.Parameters ("@enddate") = dateToDisplay.AddDays(1)
End Sub

I changed the code to use the AccessDataSourceControl1 that Web Matrix created in the process of using an Access database but I get an error when it hits: .Parameters(“@startdate”) = dateToDisplay
11/11/2003 12:25:30 AM 91979 articles. 4 followers. Follow

1 Replies

Similar Articles

[PageSpeed] 50

Ok... that was way too easy.

Just remove the @ from within front of the startdate & enddate and it works.
New code looks like this:

Sub DisplayAppointments(dateToDisplay As DateTime)
labelSelectedDate.Text = dateToDisplay
AccessDataSourceControl1.Parameters("startdate") = dateToDisplay
AccessDataSourceControl1.Parameters("enddate") = dateToDisplay.AddDays(1)
End Sub

- Ron
11/11/2003 12:35:49 AM

Similar Artilces:

Convert from Access DB to SQL DB....
Dear All,  I would like to convert from Access To SQL DB undervisual Studio.Net 2005... How can I do it easily, or if there any software to do this automaticlly, please your help..  Awaiting your valuable reply. Many thanks in advance for your cooperation and continuous support....Aح What version of MS Access are you using?Most of the Access versions like XP/2003 all have an upgrade wizard that allows you to convert your existing database to SQL Server.In Access 2003 I believe you can use the Upsizing Wizard which can be accessed from Tools -> Database Utilities -> Upsi...

Convert SQL Server DB to Access DB
Hi, I'm trying to convert a SQL Server 2000 database into a Access database because my hosting provider does not support SQL Server. I have tried the DTS, however it can only convert the tables, not the stored procedures. So is it possible to convert the stored procedures as well? I'm looking forwards to your response Phan Nguyen Hello, I believe you need some third-party components to do so, check the links below: MSSQL-to-Access 1.0 MSSQL Migration Toolkit v1.0 All are shareware tools, yuo can download and use them as a trial version. Regards.Bilal Hadiar, MCP, MCTS,...

Re-write code for an acess db to a sql db
Hi! I'm going mad. I'm trying to re-write this code so it will fit a SQLdb. But I can't make it work. Is there anyone who can help me, please? <%@ Control Language="vb" %> <%@ import Namespace="System.Web.Security " %> <%@ import Namespace="System.Data.OleDB" %> <script runat="server"> Sub Login_Click(Src As Object, E As EventArgs) If Page.IsValid Then Dim strConn as string ="PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" & server.mappath("DB/db1.mdb") &...

How to convert C#.Net code to VB.Net code ???...
HI, i was searching something new, then i suddenly find some tips to convert C#.Net code to VB.Net but i did not do well. i am puttint its url here plz tell me how to convert C#.Net code to VB.Net. Jasim...Please remember to click “Mark as Answer” on the post that helps youJasim AkhtarNew Delhi ( INDIA ) It would be better if you write the problem you having, while converting from C# to VB.NET. You cannot completely rely on online converters. ThanksMark post(s) as "Answer" that helped youElectronic ScrewWebsite||Bl...

Convert Existing User DB to Net .net MemberShip DB
Hey, Im looking to take my current Users DB and put those records into the new .net membership DB. I looked at the Membership Create User SP but im not sure if that sp is the only procedure that gets called when creating a user. I was wondering if any one else has had to do this and how should i go about it. I have about 100 users that i need to copy over. Thanks. This article has a bunch of links to Membership and security information in ASP.NET: For migrating 100 users over, you might just find it easiest to create a ...

access db to sql db rewright
I am changing a page from Access to SQL express database.  I usually use Dreamweaver Datasets and no problem with them but my hit counter is different.  Can someone rewright this code to work with a SQL database?  If t is possable to use it with a dreamweaver dataset that would be even better but i will take what I can get to learn. ThanksRusty  _________________________________________________________________ <%@ Page Language="vb" Debug=false %><%@ import Namespace="System.Data.OLEDB" %><%@ import Namespace="System.Drawing.Imag...

Access DB instead of SQL DB?
Hi folks, Is it possible to set up a Membership-Type Access DataBase in the same manner as an SQL DataBase with ASP.NET automatically configuring all of the DataBase components so that the DataBase will be the same as an SQL DataBase? In other words, could I do something like create an empty .mdb file, put it in the App_Data folder, and ASP.NET will set up the Tables, Views, Functions, etc. and configure it as I add the Login, Password, etc. Controls? Many Thanks. hypercode: Hi folks, Is it possible to set up a Membership-Type Access DataBase in the...

.Net Framework Code Access Security
I built a c# .Net 2.0 based user control that I run as an ActiveX control in IE7.  It works fine except for code access security issues ("Request for the permission of type 'System.Security.Permissions.EnvironmentPermission, mscorlib, Version=, ......' failed).  To get around the code access security issues, I created a code group within the Machine All_Code group with the Publisher membership conditions based on a valid certificate (which my assembly has) and granted that code group the "Everything" permission set.  Even though my code group is m...

how to convert VB.NET code this code to C#
Hi I have the following code whihc I need to convert to C# since I dont know VB.NET any ideas how to do this: Imports System.IO Imports System.Reflection Add the following code to the class: Private Function GetSql(ByVal Name As String) As String Try ' Get the current assembly. Dim Asm As [Assembly] = [Assembly].GetExecutingAssembly() ' Resources are named using a fully qualified name. Dim strm As Stream = Asm.GetManifestResourceStream(Asm.GetName().Name + "." + Name) ' Read the contents of the embedded file. ...

How to keep SQL DB and Access DB syncronised
Hi, I have a project which i'm trying to do for a client. It starts with an access database on the local client machine, plenty of fields but the main ones are DealerID, VehicleID, Make, Model There is also an SQL server on the internet which drives a website, it has the same fields, DealerID, VehicleID, Make, Model. I need to write an application that reads the local access file and updates the SQL server. What is the best way to do this?, At first I thought delete everything from SQL server then upload everything from Access but that doesn't seem like the best way, Really I ...

Code builder only in DB not in SQL
As I use one of the code builders, the code created is always in DB even though I have an SQL connection. DO I have to change the code on my own for an SQL connection or is there a way to set it so that the code created is always SQL. Thanks in advance....

converting Access code to .net
Would there be a way to use this command ?  Me(Value) it worked in Access Maybe there is a way to use it in .Net? What does the command Me(Value) give you? If you could send its output then I can maybe tell you its .Net equivalent.  QI. this is what the code looks like in Access For LineCount = 1 To 5LineStr = "LineCode" & Trim(Str(LineCount)) Next LineCount Me(LineStr) = UCase(Me(LineStr))If Me(LineStr) = "E" Then    Me.PONum.Visible = True  I believe its called Implicit Variables but not sure...

Code Generator for Access DB
I want to use some Code Generator tool with an Access DB, does anybody know such tools? Try Iron Speed Designer See Code Smith.You need to pay for it, but it is really good.Luis Ramirez.ADO.NET Accelerator to reduce more than 50% ADO.NET from your data access layer. Free for OleDb (Access, SQL Server, Oracle)....

Converting classic to .NET 2 code, and .NET gets an error back from ADS?
 For future-proofing, our Internal Phone Directory is being moved onto our AD servers, and obviously we're using LDAP for queries.To get the phoneboook queries working, I adapted the current classic ASP code to use LDAP, and that works fine. However, we're wanting to move these pages to .NET, and that's where the problem comes in. Using the same basic logic from the Classic code (90% of its unchanged) to produce an LDAP query, I get the error  155 Unknown error (0x80005000)This is using the same website, and so the same credentials  - unless aspx pages run und...

Web resources about - Howto: Convert sample SQL dB code to Access dB code? -

File:Convert to SVG and move to Commons.svg - Wikipedia, the free encyclopedia
As a courtesy (but not a requirement), please e-mail me or leave a note on my talk page if you use this image outside of Wikipedia. Thanks! As ...

Facebook Co-Founder Dustin Moskovitz Sells 450K Shares, Converts 7M More
The great Facebook stock sale frenzy continues on with a report that Co-Founder Dustin Moskovitz unloaded 450,000 shares in the social network ...

Facebook Announces “App2User” Liquidity Program for Merchants to Convert Rewards Points into Credits
... for Credits, just announced a new Credits program called “App2User,” designed to enable merchants and loyalty program operators to convert their ...

How to Convert Leads Into Buying Customers - The 9 Step Sales Process EVERYONE Should Use
... School of Business in Toronto on the topics of Sales and Entrepreneurship. I shared with them the sales process that I find How to Convert Leads ...

Bitcoin : Should I convert my savings to Bitcoin?
Answer (1 of 7): You should think of this question as "Should I invest all my savings in Bitcoin?", and not "Should I have my savings denominated ...

Convertizo 2 - Convert Units and Currency in Style on the App Store on iTunes
Get Convertizo 2 - Convert Units and Currency in Style on the App Store. See screenshots and ratings, and read customer reviews.

Opinion: These 5 things made me a happy iPad Pro convert
... like I needed a bigger device. But after three weeks with my iPad Pro, several things have changed my mind, and I’m officially a happy convert ...

$100 device converts all your film to digital photos
... still on film negatives. Today, we've got the perfect Amazon Cyber Week deal for you: A Wolverine F2D Mighty 20MP 7-in-1 Film to Digital Converter ...

WWE diva converts to Christianity, confesses to a life of sin
Stunning wrestling diva Taryn Terrell has shared a dramatic knock-down testimony of conversion from life in the ring to life with Christ.

Stanford Designs Underwater Solar Cells That Convert Greenhouse Gases Into Fuel
... solar industry and the battle against climate change. Importantly, writes Stanford [&hellip Stanford Designs Underwater Solar Cells That Convert ...

Resources last updated: 12/6/2015 7:25:44 AM