>The procedure for accessing secure databases through Crystal Reports for Visual Studio .NET differs between Web Forms >and Windows Forms. In a Windows Form, a dialog box automatically prompts users to enter their user name and password. >In a Web Form, however, you need to design a form that retrieves this information from the user. In both situations, >you can use code to specify the user name and password, thereby giving the same level of security to all users of >your application. > > >Setting Database Logon Parameters > >The following example demonstrates how to pass logon parameters to the tables in a report. For this example, >a connection to a secure SQL Server database is being used. > >Start a new project. >Add a Button and four Textbox controls to the form. >Name the TextBox controls serverNameTxt, dbNameTxt, userNameTxt, and passwordTxt. >Double-click the Button control to specify code for the Click event. Depending on the language you are using, >insert the appropriate. > >[Visual Basic] >' Declare require variables. >Dim logOnInfo As New TableLogOnInfo() >Dim i As Integer > >' Loop through every table in the report. >For i = 0 To report.Database.Tables.Count - 1 > ' Set the connection information for current table. > logOnInfo.ConnectionInfo.ServerName = serverNameTxt.Text > logOnInfo.ConnectionInfo.DatabaseName = dbNameTxt.Text > logOnInfo.ConnectionInfo.UserID = userNameTxt.Text > logOnInfo.ConnectionInfo.Password = passwordTxt.Text > report.Database.Tables.Item(i).ApplyLogOnInfo(logOnInfo) >Next i > >>