Showing posts with label advice. Show all posts
Showing posts with label advice. Show all posts

Monday, March 26, 2012

How to approach complex SQL query

Hi there! I'm looking for advice/suggestions on how to approach a query that's going to be much more complex than I have previously had to deal with.

I have a web form where users can select from a number of possible search parameters (say, City, State, Zip Code, etc...) and pull a list of users from this database, and can select the specific data fields they want displayed as well. The complicated part is that the possible search parameters (and data to display) are spread out over several tables.

How should I go about tackling this little monster? If it's any help, I am using Visual Web Developer 2005 Express Edition and Microsoft ASP.NET Web Matrix to create this form.

Thanks a million,

Kaiti

This question has been answered a few times here. Search for "Dynamic Where" or "dynamic search". You can even limit it results to my posts as I remember participating in at least one such thread.

|||

string strSearchTerm ="comma delimited search terms";// use regular expressions to check for malicious entriesstring[] arrSearchTerms = strSearchTerm.split(',');StringBuilder sbCmd =new StringBuilder();for(int i = 0; i < arrSearchTerms.lenth; i++){if(i != 0) sbCmd.Append("or "); snCmd.Append("[Field] = " + arrSearchTerms[i] +" ");}SELECT FROM [Table1] join [Table2] on ... WHERE// ADD sbCmd.ToString here.

Friday, March 23, 2012

how to Alter (add) a Table with default value

Hi

In SQL Server 2000

How to add a New column (c1) to the existing Table (T1) with default value as 0 and by allowing NULLs.

Please advice

Thanks

See this thread from a few days ago:

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1890218&SiteID=1

The 'search' function is a very good thing.

|||

Thanks

I found the answer. i.e.,

Code Snippet

ALTER TABLE T1 ADD C1 int NOT NULL DEFAULT (0)

Monday, March 12, 2012

How to add new fields in crystal report 11?

Hi, how do I add a new field in the crystal report? Im using crystal report 11. Please advice... :)You're 'aving a laugh, right?|||What do you mean? How can I add new fields to my report from my database? :)|||The same way you added existing ones, drag 'em there...
Or maybe there's some subtly in your question that I just don't understand?|||Do you want add new fields that are created after the report was designed? Open the report and do verify database|||Do you want add new fields that are created after the report was designed? Open the report and do verify database

Ya, the fields are new and are not in the report. How do I add the new field to the report? How do I verify database? Im very new to crystal rpt. Please guide me along...:)|||Open the report. In the menu Database->Verify Database. If if says database is uptodate, then you can add the new columns to that report