• Welcome to Valhalla Legends Archive.
 

Visual Basic w/ SQL

Started by Slaughter, December 03, 2004, 04:04 PM

Previous topic - Next topic

Slaughter

I'm using M$ SQL and Visual Basic - I've been able to generate reports from SQL statements using VB, but I cannot get SQL to grab certain things from the database and place them in a specified order - I've read tons of SQL stuff, and this still boggles me; I am grabbing data from a SQL database and generating a M$ Excel spreadsheet - I'm trying to grab data based and order it accordingly from least to greatest - I've tried grabbing all the data and "ORDER BY <insert w/e here> DESC" as well as "ASC" help! I can't get it to work correctly..

R.a.B.B.i.T

Have you tried using LIMIT to maybe 5?  I've found that helps when I debug MySQL routines in PHP.  Also I find it works best to use ORDER BY with numbers, although it works with strings, I don't like it, and I'm not sure if this helps you (since M$SQL sucks, simply because it's by Microsoft).

[/think out loud]

Slaughter

Yes, I agree M$ SQL Sucks! But thats what most of the program uses, so I have to stick with it :( Got the job dropped on me half way through the project - No, I haven't tried limit... hmm There are several pieces of info I have to grab - Names, Dollar Amounts, according to Dates, and from the largest Dollar Amount down. So in essense I grab a company name & ID as well as the Annual Revenue dollar amount, according to which dates are selected; i.e. dates between 1/01/03 - 1/30/03 and then write them in order from Highest Dollar amount to lowest. It's really pissing me off, and I'm not very experienced with SQL - I started learning it for this project, and this is the first snag I've hit. Thanks for the reply and suggestion rabbit

Banana fanna fo fanna

Yeah man. PHP and mySQL is a far easier, more scalable, more profitable, more secure, and more supported platform that that god damn Microsoft crap.

Slaughter

No other suggestions as to how to solve the problem?

Adron

Quote from: Banana fanna fo fanna on December 04, 2004, 07:54 PM
Yeah man. PHP and mySQL is a far easier, more scalable, more profitable, more secure, and more supported platform that that god damn Microsoft crap.

I don't know if I'd say mySQL is more scalable, more profitable or more secure...

dxoigmn

Quote from: Slaughter on December 05, 2004, 12:18 PM
No other suggestions as to how to solve the problem?

How about an example query string?

Banana fanna fo fanna

Quote from: Adron on December 05, 2004, 12:53 PM
Quote from: Banana fanna fo fanna on December 04, 2004, 07:54 PM
Yeah man. PHP and mySQL is a far easier, more scalable, more profitable, more secure, and more supported platform that that god damn Microsoft crap.

I don't know if I'd say mySQL is more scalable, more profitable or more secure...

Guess I wasn't being sarcastic enough.

Adron

Ah. It may be easier and more supported though. I don't think MSSQL runs on nearly as many platforms as MySQL supports?

R.a.B.B.i.T

It runs on..err..Windows.

I have no idea now MSQL works, and I've read that it's different from mySQL in many ways, so I don't really know how to help you, sorry.

Grok

Interesting topic to me, VB w/SQL, so I took a peek only to see you slamming MSSQL without really having a clue about its architecture or operations.  You barely know how to do a simple SELECT with an ORDER BY clause yet think you are qualified to denegrate an incredible RDBMS engine.  At the same time you want help to get it working on a Microsoft platform, using Microsoft Visual Basic, and other Microsoft components.

Still, I will help you.  Tell me a specific query that is returning results in the wrong order.  Show me the source code where you build the query, open the recordset, and how you display the results in your output (GUI?).  What is the backend, MS SQL Server?