|
I'm using C#, .net2.0 framework and DB2 as my database.
I need to validate a database(DB2) query which is given by the user in the textbox. Please note that I just need to validate not to execute the query(text in textbox). I dont want any third party software and I want to do in .net2.0, ASP.net, C#, DB2
Please share your ideas and solution.
|
|
|
|
|
Please don't cross post, its not useful.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
What do you mean by validate?
You could use a DataReader object to do a GetSchemaTable and if it successfully returns, you can be relatively sure the SQL query was good. You could include put "WHERE 1=2" in the WHERE portion of the SQL to return just the schema of an SQL statement, as a different way to check. You could replace any selected fields with COUNT(*) to return a count of how many records will be pulle before you run the query. You could do a .DeriveParameters on the command. There are all kinds of options available to you.
Hope this helps.
|
|
|
|
|
I'm using SQL Server 2005 Express, running on a machine on our domain. The ODBC connection string for my application normally looks like this:
Driver={SQL Server}; Server=HostSys\SQLEXPRESS; Trusted_Connection=yes; Database=VersamarkCPT;
<small>(spaces inserted for readability)</small> I would like non-domain users to be able to access this data base as well. The only way I've been able to do that is to set SQL Server to "Mixed Authentication" mode, and use a connection string like this:
Driver={SQL Server}; Server=123.123.123.123\SQLEXPRESS; Database=VersamarkCPT; Uid=username; Pwd=passwrd; I would rather use Windows Authentication if possible. I would also like to use a machine name instead of its IP address.
Is there some other connection string syntax I should be using? I've read through the SQL Server Books Online, MSDN, and articles here at CP, and haven't had a lot of luck deciphering what's going on. I'm a complete noob at DB programming, so please be kind.
Software Zen: delete this;
|
|
|
|
|
I have always found connectionstrings.com to be an invaluable source of connection information. Hopefully you will be able to answer your questions and learn a few tips from them - I know I have.
Hope this helps
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Yeah, I checked them out. Unfortunately, it doesn't appear to answer my question:
How do I use a SQL Server instance on a domain machine from a non-domain computer attached to the same network?
or, more simply,
How do I use SQL Server in a workgroup environment?
Software Zen: delete this;
|
|
|
|
|
I don't think there is any option other than to use Mixed Mode, as you already tried.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
That's the impression I had, but I wanted to ask some more experienced heads in case I was missing something.
Thanks for the reply, Bob.
Software Zen: delete this;
|
|
|
|
|
While using ADDNEW in MySQL it is creating huge Temp files?
The file size will be more than 2GB as data in the server grows.
Is there any way to reduce or stop them to create thoes files.
|
|
|
|
|
I got the answer
AddNew will create a temp file as it will insert the data into a temp file before storing it into the main Database.If you are try to inseret the data in a sorted order or if your maintaing the Indexes it will generate teh huge tmp files.
So instead of AddNew just use Insert statment it will help you to insert the data directly in to the table where u want.
|
|
|
|
|
I am using SQL Reporting Services to create reports.
The report contains limited number of rows in the middle of the report page along with the different information on the entire page.
For eg:- If there are 10 rows in the dataset, then the report should contain 5 rows on 1 report page along with other information and the remaining 5 on other page along with the same information.
Can anyone help me with this?
Thanks in advance.
|
|
|
|
|
How to comare two database,and find out difference?
|
|
|
|
|
Use the sys tables or information_schema and compare your objects on the schema, table name, and column name.
|
|
|
|
|
I found "sql delta" and "D-Softs DBC" can do this job
|
|
|
|
|
I'm getting an error calling a stored proc, and the error is about attempting to update a view, but I cannot find the location of the update, as the stored proc call calls other stored procs, etc. many, many levels deep. I've tried searching syscomments for all procs that contain the view name, and narrowed it down to nine procs, and thought I removed any updates from those procs, but I'm still getting the same error. Is there any other way to solve this rather than manual inspection?
|
|
|
|
|
Have you tried using Profiler to trace the SQL/procedures executed?
|
|
|
|
|
I'm only getting the top level procedure call in profiler.
|
|
|
|
|
Did you try tracing additional events such as SP:Starting, SP:Completed, under Stored Procedures, and SQL:StmtStarting under TSQL, or are you just accepting the default events for tracing?
|
|
|
|
|
I did now, with no joy. The execution plan isn't too helpful either because I can't search it.
|
|
|
|
|
Put a try - catch block in the starting SP and use the ERROR_PROCEDURE() function.
Thanks.
|
|
|
|
|
That's cool to know, thanks, but in this instance ERROR_PROCEDURE() returns null.
BEGIN CATCH
ROLLBACK TRANSACTION
SELECT ERROR_PROCEDURE() AS EP
END CATCH
|
|
|
|
|
Sorry, at the moment I don't really have any other suggestions. I've usually had pretty good luck with Profiler. Are you filtering anything out? Perhaps try saving the trace to a text file and searching that?
|
|
|
|
|
Thanks anyway. It turns out that the one proc actually loads dynamic SQL from a table and executes it.
|
|
|
|
|
Well, that's just cheating.
Anyway, glad you found it.
|
|
|
|
|
Why CTT*.tmp files are generating in %temp% while runing MySQL with ODBC connectivity.
The CTT*.tmp are growing in size as records are growing.
It is reaching upto 2GB.
Due to this my C drive is filling up and leading to crash.
Please help me out by telling what are CTT*.tmp files?
and why are they generated?
|
|
|
|