Labels

Flash (1)

Friday, December 10, 2004

Insert Into SQL Statment using Dates

When using dates or times, they need to be in the correct format to add them to your database. Make sure they are valid dates, then surround them with # signs.

Example:


strSQL = "INSERT INTO Events([Date], EventName, Location, [Time]) VALUES (#" & CDate(txtDate.Text) & "#, '" & txtEventName.Text & "', '" & txtLocation.Text & "', #" & CDate(txtTime.Text) & "#)"


Tuesday, November 30, 2004

Failed to enable constraints.

"Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints. "

We get this error when trying to fill a child table before filling the parent. Make sure you fill the parent table first.

Monday, November 29, 2004

CSK - Data, Data, Data

Although I haven't asked the question on the CSK forum yet, I am pretty sure that I am getting the "No communities configured" error because I have no data in the database. My options for getting data into the dataset are using a CSV import or generating SQL insert scripts.

I thought I would try the CSV import. I copied the records in the table into an excel spreadsheet, and then saved it as a CSV - comma delimited. That didn't work because some of the data in the fields had commas in them. Changed to a tab delimited fields. Some of the longer fields took too many cells, and I got a wrong number of column error.

I am now going to hack the admin login to see if I can bypass IsAuthenticated to get to an admin page to set up the database. Fun, fun, fun!!

Wednesday, November 24, 2004

The Case of the Disappearing DataSets

In the data tier component, when using multiple data adapters; sometimes datasets just disappear!!!! When you try to add them back in, you get crazy names like DataSet21, DataSet31, etc. First, edit your generated code to remove all references to these datasets. Also, kill the .xsd files in the project. Then, instead of right-clicking on the data adapter to create the dataset, right-click in the component window(not on any control). Believe it or not...this seems to work!

Missing information in Combo Box

If you are trying to fill a combo box with a dataview from your data tier component, make sure you have set the Table property of the dataview to the correct Table. Also, make sure that you are using the correct dataset that contains all the records you want to view.

So Close with the CSK

I kept fiddling with the Web.config file until I got a connection that worked. Now, I can get to the ISPAdministrator pages, and I can update the database!!!! :)

I get the default.aspx page which says I have no community set up (even though I do).

I compared the tables and procedures and found a few procedures that were wrong so I got them fixed.

Still don't have any sample data.

The default.aspx page suggests I reinstall the CSK. I still think there is a problem with starting out with a blank database.

Wednesday, November 17, 2004

The CSK Saga Continues

The book came! Even though it was addressed to me in Indiana and I live in Iowa, somehow it arrived at my doorstep all the way from the UK! The book is Building Websites with the ASP.NET Community StarterKit by K. Scott Allen and Cristian Darie.

I immediately jumped to the chapter on Deployment. I guess that I want to get this to my site before I start customizing it.

Since I want to keep a little game I programmed, I was particularly interested in the "Working with Other Sites" section. With this help to modify the CSK, I added my little game and got it to run locally!

Now I changed my connection for the database, made sure debug was false in the Web.config, and did a Release of the program.

From the deployment chapter information, I installed Front Page Server Extensions to my web account and then did a Copy Project deployment from Visual Studio. WOW it all worked.

I am now getting this error Login failed for user 'HOSTING\WINHOST07$'. I think this is a success! I still have no data in the database -- and the error for that one procedure. I also found an ownership fix that won't run. The login failed at least told me it was trying to attach itself to the database!

Now I'm off to find out some way to get some data in the database -- at least the admin user account!

Tuesday, November 16, 2004

Having a problem with IE -- home page keeps changing

Try this Ad-Aware program. There is a free personal version. It worked great for me!
http://www.lavasoftusa.com/software/adaware/

Wednesday, November 10, 2004

Web Page Design Considerations

Most web users use an 800x600 screen setting or higher. Try to make sure your web page will print on an 8 1/2 x 11" sheet of paper or offer the user an option for a more friendly print option without all the navigation of the web site.

Tuesday, November 09, 2004

Testing Programs

When testing a program, don't test it to see if it works; test it to see if you can break it! You want to have it break for you before you put it into production and it breaks on your client!

Deploying the CSK - Update

Well, I have access to my SQL Server remotely, and the host provider has already set up a database for me. Now I need to set up the tables and load some data. I used the Query Analyser to run the scripts found in the Setup folder of the CSK. Worked fine except one. Still trying to get that to work. Also, can not figure how to get the data in there to set up the admin account.

I don't think my permissions are set right on the dbo. My mappings are also probably wrong. I uploaded the code, and now I get a Runtime Error.

I have ordered a book specifically designed for the Community Starter Kit. Maybe it can shed some insight on how to get this deployed.


Tuesday, November 02, 2004

Let's Deploy the CSK to the Web!

From www.asp.net, I downloaded the Community Starter Kit (CSK). Wow! It uses multi-tier applications and builds web pages on one form. Neat programming techniques here. Well, I have some ideas on how I would like to use that so I found a web hosting site that supports ASP.NET and MS SQL. I purchased a domain name and a year's worth of hosting. I purchased the year's worth of hosting so that I could get the bargain rate! :)

I found that I could use the SQL Scripts supplied with the CSK to run in the Query Analyser of the MS SQL server. My web host allows me to connect remotely through a web interface.

I got all the 65 or so tables set up. Got all but one of the stored procedures set up. I keep getting an error Error -2147217900 "Line 45: Incorrect syntax near TRANSACTION." I had four stored procedures that were not set up, but I tried putting through the code again, and am now down to just one. It is the Community_VotingPollChoicesUpdateSortOrder.


Adding an Expression to the DataSet Schema

When you need information from a database in a format other than it is stored, you can create an expression to gather that information expressed in a new way. You do this through the DataSet Schema.

From the Solution Explorer, select the .xsd file. You should see a list of fields and their types. Scroll down to the last line of the table and click in the first column. Select E element from the list. Then type in your expression such as lastname + ', ' + firstname. Make sure you rebuild your solution. That field should now be available to use in databindings so you can display it on a form.

Friday, October 22, 2004

Option Strict -- Always On

How do you make Option Strict always on without having to type Option Strict at the top of your forms and modules?

In Visual Studio.NET, go to Tools>Options>Projects -- then select Option Strict ON.

Thursday, October 21, 2004

......It is already opened exclusively by another user, or you need permission to view its data.

The Access Database must be placed in the All Users/Shared Documents folder on your local machine. Make sure that the ASPNET has permissions on that folder. (Right-click on Shared Documents folder, select Sharing and Security, select the Security tab, add the ASPNET user or make sure correct permissions are set.)

Monday, October 18, 2004

Creating a Generic SQL Server Connection String

If you are moving an SQL Server VB.NET project from machine-to-machine, (such as from home, to a lab, to a classroom) you need to have a generic connection string for your database.

Use this:

server=(local\NetSDK;Trusted_Connection=yes;database=Cottages)

where NetSDK is your INSTANCENAME and Cottages is your database name.

Friday, October 15, 2004

Unable to start debugging on the web server.

If you get the message, "Error while trying to run project: Unable to start debugging on the web server. The project is not configured to be debugged." You might not have created a virtual directory in IIS for your project.

To do this, right-click on My Computer.
Select "Manage."
Expand Services and Applications
Expand Internet Information Services
Expand Web Sites
Expand Default Web Site (or wherever your application is hosted)
Go to your project folder (it should have the folder icon)
Right-click on your project folder
Select "Properties"
Click on the Create Button.
Your project folder will change from the folder icon to the package icon.

Also, you may not have ASPNET user set up on your project.
Try this:
Find your project folder in C:\inetpub\wwwroot
Right-click on it and select "Sharing and Security"
Select the Security tab
Is ASPNET there?
If not, click on "Add"
Click on "Location" and select your local computer
Type in the user name "ASPNET"
Click OK
It should have added that user to your list of users.
Now make sure ASPNET user had read/write/modify priviledges.



Microsoft also has some help on this: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsdebug/html/vxtbshttpservererrors.asp

Monday, October 04, 2004

In Search of Answers to VB.NET

Here are some great sites to try:

The "Big Daddy" of all! http://msdn.microsoft.com/vbasic/

All about ASP.NET http://www.asp.net

VB at the Movies - 101 short movie clips http://msdn.microsoft.com/vbasic/atthemovies/

101 Examples for VB and C# http://www.microsoft.com/downloads/details.aspx?familyid=08e3d5f8-033d-420b-a3b1-3074505c03f3&displaylang=en

Webcasts http://msdn.microsoft.com/vbasic/community/webcasts/default.aspx

Seting Initial Focus

How do you set initial focus on a web control in VB.NET?

Manually edit the HTML code for your webform.
Inside the body tag, place the following code:

onload="Form1.yourcontrolnameTexBox.focus()"


NOTE: The form name is found in the ID tag in the HTML code of the webform. The textbox ID is in the properties of the control.

Friday, October 01, 2004

Case of the Missing Message Box

We just upgraded our lab to Visual Studio.NET 2003. We continue to run 2002 for compatibility reasons.

Quirk...The information in MessageBox.Show commands has disappeared!!! This is also true with the buttons in the Font and Color CommonDialog boxes.

Haven't fixed this one yet, but am looking for a solution. It is frustrating not being able to see a message or see what is on a button.


Swamped with Paper

One of my goals -- about 5 years ago -- was to create a paperless classroom. Well, needless to say, that hasn't happened yet. This is my blog to move me toward that goal. I plan to use this to post those findings, mostly programming or networking related, that clutter my office with paper -- and then I can't find them when I need them! I also hope others might benefit from my ramblings! :)