hollystyles 113 Veteran Poster

greeny_1984: Well that would just exhibit the same behaviour as whats currently happening. But you're on the right track.

Image buttons are rendered as type="submit" which means when you press the enter key it is assumed you are submitting. This is an HTMl Forms standard thing.

You need to place your credentials controls in an asp:Panel and set the DefaultButton attribute of the panel to the save button ID for your form.

hollystyles 113 Veteran Poster

Stored procedures need to be created using the CREATE PROCEDURE statement and then executed (F5 or the green play button in the toolbar). They are compiled and stored in the database itself. If you choose save in the Mangement Studio file menu this is just a convenient way to save your TSQL as a text file for use elsewhere, or to send to someone else, or to re-create it as part of a deployment script if you want to set up the same database on another Sql Server instance.

hollystyles 113 Veteran Poster

I managed a couple of months over Christmas, but am smokin' again. Thinking I will never quit now. One more smoker in the world... again.

hollystyles 113 Veteran Poster

Yep.

hollystyles 113 Veteran Poster

It's late and I'm a little blurry. But from what I can see in your query I think this: tDocumentsA.user_id = tUsers.contact_id should be: tDocumentsA.user_id = tUsers.id (the same for all document table joins) And all your JOINS should be INNER JOIN not LEFT OUTER JOIN.

hollystyles 113 Veteran Poster

It's just a preference. I like things to be as loosley coupled as possible. I prefer to bind to collections of objects, rather than strongly typed datasets. Like most things it depends on what your requirements are. I wouldn't worry about it too much as this is your first real program.

I'm sure the presentation of the address can be done in a better way, using a bindingsource. When I have figured it out I'll post my solution here. (I do mostly web apps so I'm a bit rusty with forms where the platform is a little different)

hollystyles 113 Veteran Poster

Oops perhaps you are doinf a Forms project not a web project.

I have started a forms project and I can't get the binding source to use the new query either yet. I am too tired at the moment.

One solution could be a computed column in the sql table, but that smells a bit to me.

hollystyles 113 Veteran Poster

The query has the single column you want 'Expr1' bind the textbox to that.

I am not very knowledgeable with BindingSources I am afraid, I don't like them. I prefer to have simple business objects.

So I would not do the concatenation in the TSQL (it doesn't really belong there, it belongs in the presentation layer or as a business rule) So I would have an Address class and an AddressSource class, the AddressSource is in the DataLayer and uses ADO to connect to the DB and lift the data and returns an address object, then make the Address object provide the concatenated address with carriage returns.

I attach an example project I knocked up in response to this thread. There is a .sql script in the AppGloablResources folder that creates the table and populates a demo record.

hollystyles 113 Veteran Poster
SELECT Name + '\n' + Street + '\n' + ZipCode +'\n' + City
FROM Customers
WHERE (CustomerID = @1)

This assumes none of the columns allow NULLS. Otherwise you will need to use ISNULL(name, '') + '\n' + ... etc

Set the TextMode property of you textbox to Multiline (it will render to the browser as a textarea) set the rows property of the textbox to 4.

hollystyles 113 Veteran Poster

Oops we posted at same time. When restoring you will have to tweek some options: 1. the name for the database (cos it doesn't exist on the new server yet) just type it in the drop down box. And 2. The paths to the .mdf (data) and .ldf (transaction log) files. Set these in the second tab of the restore dialogue box, no sorry that's Enterprise Manager (Sql 2000) theres a n 'Options' item in the list top left pane.

hollystyles 113 Veteran Poster

Right click the database -> Tasks -> Back Up...

More info here (quite a way down it looks at SSMSEE in depth) Just CTRL + F for 'Backup'.

http://www.microsoft.com/technet/prodtechnol/sql/2005/mgsqlexpwssmse.mspx

hollystyles 113 Veteran Poster

This is similar to a problem I have. I have a database in SQL Server Express, and need to migrate it to another server running SQL Server 2004. Is there a simple way to do this without having to go through SSIS?

Do a complete backup, copy the file to the other server and restore it there.

Or you can detach the database, copy the .mdf and .ldf files zip them up and copy them over to the new server, unzipp and then attach them.

hollystyles 113 Veteran Poster

MS Access !! yuck !! You didn't say you were using Access, and as this is a MS SQL Forum I used TSQL.

Ok just for you I have recreated everything in Access and tweaked the SQL. Basically removed all formating, changed joins to INNER JOIN, added the AS keword where aliases were being used , bracketed the multiple column joins between quote_tb and the sub-query table mq and added the trailing semi-colon.

SELECT quote_tb.ID, quote_tb.item, vendor_tb.name, mq.minprice, vendor_tb.[phone#], vendor_tb.[fax#]
FROM (quote_tb INNER JOIN (select [ID], item,  min(quote) as minprice from quote_tb group by [ID], item) mq ON (quote_tb.quote = mq.minprice) AND (quote_tb.item = mq.item) AND (quote_tb.ID = mq.ID)) INNER JOIN vendor_tb ON quote_tb.vendor = vendor_tb.name;
hollystyles 113 Veteran Poster

That works. Also there is TSQL's ISNULL function.

SELECT 
    ISNULL(FirstColumn, '') + ' ' + ISNULL(SecondColumn, '') AS ResultColumn
FROM 
    mytable
hollystyles 113 Veteran Poster

Excellent. Please mark thread solved :)

hollystyles 113 Veteran Poster

Fee Fi Fo Fum I smell the blood of a Tsql Cursor, be he slow or be he slower, I'll grind his bones with my set theory mower.

Sorry I'm on a personal crusade against cursors :)

I offer my own humble solution:

DELETE FROM names
WHERE
 EXISTS
 (
 SELECT
  PKID
 FROM
  names Dupnames
 WHERE
  Dupnames.name  = names.name
  AND Dupnames.lastname = names.lastname 
  AND Dupnames.PKID < names.PKID
 )
hollystyles 113 Veteran Poster

ViewState is held in a hidden field within the rendered webpage, session state is held in the memory of the webserver. Each session has a unique id called a sessionid. The sessionid is given to the client browser on first request and quoted by the browser on each subsequent request from then on. It may well be the sessions are held in memory in some kind of dictionary object, it makes sense but I have no idea.

majestic0110 commented: Helpful information, many thanks! +1
hollystyles 113 Veteran Poster

Hmm re-reading your post that may not be quite what you want, you want lowest quote regardless of vendor I think.

select 
	q.[ID], 
	q.item,
	v.[name], 
	mq.minprice, 
	v.phone#, 
	v.fax#  
from 
	quote_tb q 
	join 
	(
		select 
			[ID], 
			item,  
			min(quote) minprice 
		from 
			quote_tb 
		group by 
			[ID], item
	) mq on q.[ID] = mq.[ID] 
		and q.item = mq.item 
		and q.quote = mq.minprice 
	join vendor_tb v on q.vendor = v.[name]
hollystyles 113 Veteran Poster

Firstly just join the quote_tb to the vendor_tb. That gives the vendor details for ALL quotes.

Then use GROUP BY (to merge up all the repeating colums (ID, item, name, phone#, fax#) and the aggragate function MIN on the quote column to reduce the result set to just the lowest (MIN) quote amounts.

select 
    q.ID, 
    q.item, 
    v.name, 
    min(q.quote) minprice, 
    v.phone#, 
    v.fax# 
from 
    quote_tb q join vendor_tb v on q.vendor = v.name 
group by 
    q.ID, 
    q.item, 
    v.name, 
    v.phone#, 
    v.fax#

That gives ALL minimum quotes, if you want just a particular quote ID just add a where clause: where q.ID = 11

select 
    q.ID, 
    q.item, 
    v.name, 
    min(q.quote) minprice, 
    v.phone#, 
    v.fax# 
from 
    quote_tb q join vendor_tb v on q.vendor = v.name 
where 
    q.ID = 11 
group by 
    q.ID, 
    q.item, 
    v.name, 
    v.phone#, 
    v.fax#
hollystyles 113 Veteran Poster

Well it asks for username and password and then tells me I am not allowed to see that.

This is due to windows integrated authentication (NTLM), although you are logged into Windows those credentials are not necessarily automatically passed on when required it certain circumstances. Here are the solutions:

For IE (thanks to Ron Symonds - Microsoft MVP (FrontPage)):

Have you installed IE7?
If so, (and this may work anyway)
In Internet Explorer
Tools->Internet Options
Security Tag
Click "Local Intranet"
Click "Custom Level"
Scroll down to the bottom to the User Authorisation section
Select "Automatic Logon with current User Name and password"
Click OK, Click Yes

You may need to add Localhost to the Intranet zone - if so click the
Sites button and Advanced link.

Click OK
--

For FireFox (Thanks to Peter Orologas):

Firefox - Enter username and password for "" at http://localhost - Solution

IIS uses Integrated Authentication and by default IE has the ability to use your windows user account...but don't worry, so does Firefox but you'll have to make a quick configuration change.

1) Open up Firefox and type in about:config as the url

2) In the Filter Type in ntlm

3) Double click "network.automatic-ntlm-auth.trusted-uris" and type in localhost and hit enter

4) Write Thank You To Blogger

As Always, Hope this helped you out.

Pete Orologas
hollystyles 113 Veteran Poster

httpd.exe *IS* Apache. End the process in task manager and then try starting Apache again.

hollystyles 113 Veteran Poster

Type netstat -a -n -b at a command prompt this should list listening ports and what executable is listening on it (thats what the b switch does, mine shows inetinfo listening on TCP:80 which is IIS)

Hmm just realised I am assuming you have a windows rig.

Also if you have port 80 forwarded to .100 what box has that address ? because if something already has that address and you changed your machine with the not running apache to that address too... well thats an IP address conflict which will cause strange behaviour.

hollystyles 113 Veteran Poster

Why do you say that? I've been reading about it for about 15 hours

Wow! well how you can read 15 hours of ASP.NET getting started and surmise that merely changing the file extension of an HTML page is all that's required seems improbable.

But what the hey. Ok you can't just point IE at an aspx page in your file system, an aspx file needs to be processed by a web-server typically IIS and the .NET CLR (The framework). Visual Studio Express Edition has one built-in. Do you have Visual Studio ? installed? and the .NET Framework? that's definately step 1. They're free and you can get it from http://asp.net

The latest framework is version 3.5 and the latest VSEE is 2008

OPen VS and select New -> Website from the File menu, you should get a file in Solution Explorer ( a window with all the project files listed to the right hand side) named Default.aspx, paste your HTML in there (be sure to the leave the <@ page stuff and the DOCTYPE stuff and the opening <Form id="From1" runat="server"> and the closing </form>
tags intact .

Right click the Default.aspx file and choose 'Set as start page' in the context menu that appears.

Save everything (CTRL + SHIFT + S)
Press F5 key (start the debugger and launch your page in your default browser)
The first time you do this VS will moan about a debug directive …

hollystyles 113 Veteran Poster

The problem is you haven't researched ASP.NET properly.

Use Google (or your favourite search engine) to search tutorials like this:

http://www.sitepoint.com/article/getting-started-asp-net

hollystyles 113 Veteran Poster

Only one application/service can listen for a given protocol on a given port at a time, what on your computer do you have other than Apache that might be serviceing HTTP on port 80 ? IIS for example.

hollystyles 113 Veteran Poster

I think something else you have installed is listening on port 80, browse http://localhost what do you see ?

hollystyles 113 Veteran Poster

I can't understand why you can't get web controls to appear on the page. Can you post some code?

p.s. Do you know about the empty data template?

hollystyles 113 Veteran Poster

I've replied in your other thread.

How are you 'Browsing' your ASP.NET app ?

hollystyles 113 Veteran Poster

You don't need IIS if you have Visual Studio 2005 Express Edition (any edition 2005+) It includes a web server. When you run the app from VS (F5 to debug, or Ctrl+F5 to run without debugger) it starts up automatically on http://localhost:<some random port number> (you get an icon in your sys tray too showing it's running)

majestic0110 commented: very polite & helpful +1
hollystyles 113 Veteran Poster

unfortunately am using 2.0 of the framework (wow!).

Well that's what 90% if the software world is using. Hell I'm still maintaining Framework 1.1 projects.

Back in the time of classic ASP, one day I found myself conactenating <tr> <td> tags in a loop for a recordset in VBScript for the umpteenth time (I was still a fairly green coder then) when I suddenly realised "Hey! the computer should be doing the work, I'm bored of typing strHTML = strHTML & "<some tag> blah..."

I had just discovered what OOP meant and what a Class was and that VBScript could do classes (to certain extent.) So I made one that concatenated <tr> <td> tags (eventually I made it do subtotal rows and all sorts but that's another story) so from then on I just passed the recordset object to my table class and asked it to WriteTable().

Of course lots of other developers were doing this too. That's why webcontrols exist in .NET, and that's why I struggle with the concept of ever not wanting to just do Control.DataSource = dt; Control.DataBind(); But I guess that's because the novelty of seeing my carefully concatenated HTML rendered in a page has worn off now, when it was a new concept I though it was great.