Category Archives: Demo Software

How To’s for Microsoft Access and SQL Azure with Code

Here are some How To’s to help get you started with SQL Azure. Some of them can also help with SQL Server.

How to Create Logins in SQL Azure

Create Logins Using SQL Server Management Studio (SSMS):

Logins must be created in the master database. To create a Login in SSMS I normally right click on the server and select “New Query” which opens a blank query in the master database. It must be run from the master database because you cannot use “USE master” with SQL Azure.

T-SQL:

CREATE LOGIN MyLoginName WITH password = 'zX/w3-q7jU'
GO

To be secure Passwords must follow the required Password Policy. It is best to use Strong Passwords. They must be at least 8 characters long and contain at least one number or special character such as -/~^&. Since ODBC connection strings utilize the characters []{}(),;?*!@ they should not be used in Passwords.

Create Logins Using Microsoft Access:

You can create Logins with Microsoft Access with VBA using an unnamed temporary Pass-through QueryDef, which is a technique recommended in the Microsoft Access Developer References. You can use the following sample code, passing the Login Name and the Password to the Function:

'Example usage: Call CreateLogin("MyLoginName", "zX/w3-q7jU")

Function CreateLogin(strLoginName As String, strPW As String) As Boolean
On Error GoTo ErrHandle

    Dim db As DAO.Database
    Dim qdf As DAO.QueryDef
    Dim strSQL As String

    strSQL = "CREATE LOGIN " & strLoginName & " WITH password = '" & strPW & "'"

    Set db = CurrentDb

    'Create the Logins
    Set qdf = db.CreateQueryDef("")
    qdf.Connect = GetConnMaster 'Function to get Connection string to master database in SQL Azure
    qdf.SQL = strSQL
    qdf.ReturnsRecords = False

    qdf.Execute dbFailOnError

    'If no errors the Login was Created
    CreateLogin = True

ExitHere:
    'Cleanup for security and to release memory
    On Error Resume Next
    Set qdf = Nothing
    Set db = Nothing
    Exit Function

ErrHandle:
    CreateLogin = False
    MsgBox "Error " & Err.Number & vbCrLf & Err.Description _
    & vbCrLf & "In procedure CreateLogin"
    Resume ExitHere

End Function

Return to Top

How to Create Database Users in SQL Azure

Create Database Users With SQL Server Management Studio (SSMS):

Database users must be created in the database in which they will exist and usually the Login Name is used as the Database User Name.

T-SQL:

CREATE USER MyLoginName FOR LOGIN MyLoginName
GO

Or:

CREATE USER MyLoginName FROM LOGIN MyLoginName
GO

 

Create Database Users With Microsoft Access:

You can create Database Users with Microsoft Access using the following sample code, passing the Login Name to the Function:

'Example usage: Call CreateDBUser("MyLoginName")

Function CreateDBUser(strLoginName As String) As Boolean
On Error GoTo ErrHandle

    Dim db As DAO.Database
    Dim qdf As DAO.QueryDef
    Dim strSQL As String

    strSQL = "CREATE USER " & strLoginName & " FOR LOGIN " & strLoginName

    'Create the Database&nbspUser
    Set db = CurrentDb

    Set qdf = db.CreateQueryDef("")
    qdf.Connect = GetConnDB 'Function GetConnDB gets Connection string to the database
    qdf.SQL = strSQL
    qdf.ReturnsRecords = False

    qdf.Execute dbFailOnError

    'If no errors the Database User was Created
    CreateDBUser = True

ExitHere:
    'Cleanup for security and to release memory
    On Error Resume Next
    Set qdf = Nothing
    Set db = Nothing
    Exit Function

ErrHandle:
    CreateDBUser = False
    MsgBox "Error " & Err.Number & vbCrLf & Err.Description _
    & vbCrLf & "In procedure CreateDBUser"
    Resume ExitHere

End Function

Return to Top

How to Build an ODBC Connection String in Access

For instructions and examples on how to build and use an ODBC Connection string in VBA see my article Building Safer SQL Azure Cloud Applications with Microsoft Access

Return to Top

How to Migrate a SQL Server Database to SQL Azure by Generating Scripts

Generate a Database Script for SQL Azure from the Journey to SQL Authority with Pinal Dave blog. A very helpful article that shows how to build a SQL Azure database by generating scripts from an existing SQL Server database.

In smaller databases it may be practical to also Migrate the Data by Generating Scripts using SSMS.

How to Migrate Both Schema and Data

1) Migrate the Schema.

I recommend that you first follow the example in the article and migrate the schema first. That will give you the opportunity to make any changes that might be needed. As shown in the article you click on the “Advanced” button, followed by clicking on “Script for the database engine type”, and then selecting “SQL Azure Database”. Then click on “Types of data to script” and select “Schema only”.

2) Migrate the Data.

As before you click on the “Advanced” button and “Script for the database engine type” and then select “SQL Azure Database”. But this time select “Data only” for the “Types of data to script”. This may produce a large script depending upon the amount of data stored in the database.

Return to Top

Get the free Demonstration Application that shows how effectively Microsoft Access can use SQL Azure as a back end.

More Free Downloads:
Us or UK/AU Pop-up Calendar
Report Date Dialog Form in US or UK/AU Version.
Free Church Management Software with Contributions management.
Code Samples

Get the Access and Outlook Appointment Manager to manage all of your Outlook Calendar Appointments and Access dated information.

Happy computing,
Patrick (Pat) Wood
Gaining Access
http://gainingaccess.net

Links from The Microsoft Access and SQL Azure Information Center for Developers

Here are some of the main links from The Microsoft Access and SQL Azure Information Center for Developers about using Microsoft Access as a front end (GUI) for SQL Azure.

Much of the information here will also benefit Access developers using Hosted SQL Server back ends.

Downloads
Links and information about important Access, SQL Azure, and SQL Server downloads.

Official Microsoft SQL Azure Pages
These important links enable you to open and manage your Azure account and databases.

How To’s with Code Samples

Helpful Articles, Blogs, and Links

Differences between SQL Azure and SQL Server

My Articles

Access Links for Developers

Get the free Demonstration Application that shows how effectively Microsoft Access can use SQL Azure as a back end.

More Free Downloads:
Us or UK/AU Pop-up Calendar
Report Date Dialog Form in US or UK/AU Version.
Free Church Management Software with Contributions management.
Code Samples

Get the Access and Outlook Appointment Manager to manage all of your Outlook Calendar Appointments and Access dated information.

Happy computing,
Patrick (Pat) Wood
Gaining Access
http://gainingaccess.net

The New Microsoft Access and SQL Azure Information Center for Developers

Learning to develop Microsoft Access Cloud applications using SQL Azure as a back end is new territory. Although there are many similarities to developing an Access application that uses a hosted SQL Server database, there are also a number of differences that can trip you up unless you are aware of them. For example in one place Microsoft informs us that “Connecting to SQL Azure Database by using OLE DB is not supported.” Since ADODB uses OLE DB this means that ADO is not supported for connecting to SQL Azure. However in other places we are informed that we can use ADO if we use the SQL Native Client and that support for OLE DB is being considered for official support. To make ADO work we must use Provider=SQLNCLI10; instead of Provider=SQLOLEDB; in our connection strings. This is the type of critical information we work to provide.

The biggest problem I faced when I began developing with Access and SQL Azure was finding the information and help I needed. I have found no single web page, site, help file, document, or source of information on how to develop Access Applications that could use SQL Azure. I spent countless hours using online searches, downloading documents, using SDKs, reading books and reading online to get the necessary information and solve problems. Some vital information could not be found so at times I had to learn through trial and error. There needs to be a better way for Access developers to get the crucial information we need to develop with SQL Azure.

So I am gathering together information, links, tips, scripts, and articles and building a Microsoft Access and SQL Azure Information Center for Developers to save you some valuable time and headaches. We will list important links, downloads, articles and blogs, scripts, code samples, tips, and new developments.

You are welcome to submit your own tips, code samples, links, comments, and articles. You can contact me at patwood@gainingaccess.net. Be sure to let us know if you want us to publish a link or email address so we can give you credit for your submission. We want to maintain a standard of high quality and usefulness so all submissions will be screened for value and relevance.

Even as I was preparing this post I received a request in an email from a developer asking where they could get information about developing Access and SQL Azure applications. It looks like I had better get busy.

While I am busy you can download and try out our free Demonstration Application that shows a little of what can be done with Access and SQL Azure.

More Free Downloads:
Us or UK/AU Pop-up Calendar
Report Date Dialog Form in US or UK/AU Version.
Free Church Management Software with Contributions management.
Code Samples

Get the Access and Outlook Appointment Manager to manage all of your Outlook Calendar Appointments and Access dated information.

Happy computing,
Patrick (Pat) Wood
Gaining Access
http://gainingaccess.net

Microsoft Unveils New Features for SQL Azure

Steve Yi’s PDC 2010 video, “What’s New in SQL Azure?”, reveals the new features Microsoft is now adding to SQL Azure. The features include a new SQL Azure Developer Portal and web-based Database management tools. The new SQL Azure Data Sync CTP2 enables SQL Azure databases or tables to be synchronized between SQL Azure and on-premises SQL Server databases. Additionally, the new SQL Azure Reporting CTP enables developers to save SQL Azure Reports as Microsoft Word, Microsoft Excel, and PDF files.

Microsoft announced that all of these features will be available before the end of the year. The SQL Azure Reporting CTP and the SQL Azure Data Sync CTP2 are beginning to be made available to developers now. You can apply for the CTPs here.

Our free downloads include the new Microsoft Access and SQL Azure and demonstration application which uses Microsoft Access and SQL Azure to leverage the power of cloud computing.

More Free Downloads:
Us or UK/AU Pop-up Calendar
Report Date Dialog Form in US or UK/AU Version.
Free Church Management Software with Contributions management.
Code Samples


Get the Access and Outlook Appointment Manager to manage all of your Outlook Calendar Appointments and Access dated information.


Happy computing,

Patrick (Pat) Wood
Gaining Access

Cloud Computing with SQL Azure and Microsoft Access

Lately I have been developing with SQL Azure®, Microsoft’s Cloud version of SQL Server® and I am loving it. With Microsoft Access® as a front end SQL Azure is fast! It is much faster than loading webpages.

You will soon be able to use the simple free demonstration application I am developing anywhere your computer can connect to the internet, 365 days a year around the clock. Just think of what we will be able to do with this capability that SQL Azure makes possible! A technician on a service call can enter all the data he needs right on the spot and get all the information about his next service call. Back at the office a fellow employee can see the list of items the technician used and he can order the items needed so they can keep the technicians adequately supplied. An employeee can register a sale on the road and the customer’s order is instantly processed for fast service. An office on the East coast can access the data that someone at the office on the West coast just entered. Appointments can be made without causing scheduling conflicts. Almost every business large or small can benefit from a SQL Azure application.


What does it cost you ask? We can develop applications that cost a fraction of what it normally would cost because we are using Microsoft Access as the User Interface. If you do not have Microsoft Access the Access runtime is free so anyone can run this software. Applications that would normally take months for a team of developers to produce a web based application can be done in weeks by a much smaller number of people using Microsoft Access and SQL Azure.


Maintenance costs are also affordable and Microsoft has a number of different service plans so you can get a plan that meets your needs and your budget. Even very small businesses can afford the “Pay As You Go” plan for $9.99 a month plus consumption charges.


You may wonder if your sensitive information will be kept safe and secure. SQL Azure is SQL Server in the “Cloud” so you get all the benefits of SQL Server security. This is the same security used by many large corporations. Some similar applications using Microsoft Access and SQL Server have hundreds of users and we recently learned of an application with over 1200 users that works securely. Our SQL Azure applications are strictly limited to allow access to only what is needed to get the job done. SQL Server security can be fine-tuned to keep your data very secure.


Another benefit of SQL Azure is the security and protection provided by Microsoft against loss of data. Every SQL Azure database is safely located in one of a number of Microsoft data centers around the world. Every data center is owned and managed by Microsoft and we get to choose which data center hosts our SQL Azure database. My database is right here in the USA where I live instead of on the other side of the planet. Of course if I lived in France I would want to use the European data center. You can take a video tour of one of Microsoft’s massive and secure data centers.


Years ago lightning struck the utility pole in my yard and it fried my hard drive. I lost everything. Now I make backups of my backups! With SQL Azure Microsoft automatically backs up your database. They provide automatic failover which means that you have redundant copies of your data on different physical servers so if there is a hardware failure you are automatically switched to a backup copy and you will never even know there was a problem. You don’t get that kind of data protection with just any hosting service.


I plan to release the simple free demonstration application soon so you will get to kick the tires and take SQL Azure for a spin.

Update: You can now download our new Microsoft Access and SQL Azure and demonstration application and learn about how we can use Microsoft Access with SQL Azure to leverage the power of cloud computing.

More Free Downloads:
Us or UK/AU Pop-up Calendar
Report Date Dialog Form in US or UK/AU Version.
Free Church Management Software with Contributions management.
Code Samples


Get the Access and Outlook Appointment Manager to manage all of your Outlook Calendar Appointments and Access dated information.


Happy computing,

Patrick (Pat) Wood
Gaining Access

Follow

Get every new post delivered to your Inbox.