|
I have written a SQL script to run from my code using executesql command..meaning that i have framed the sql script and have it in a string and i pass the string to the ExecuteSQL funtion which executes my sql script..my scripts functionality is to insert some 1000 rows into a table..when my code executes the script runs(which i came to know from profiler) but the rows are not inserting..
can anyone tell me as wat could be the reason??
NOTE: there are no conditions in the script that ll prevent the insertion happenning
its a bit urgent..
thanks in advance..
|
|
|
|
|
I suspect there is an error in the script.
Best regards,
-----------
Igor Sukhovhttp://sukhov.net
|
|
|
|
|
|
the script doesnt have any error..
My script is running fine in Query Analyzer and it doesnt have any GO statements..so is GO statement required for my script?? My script will be a maximum of 70 lines thats it..kindly suggest..
any other clues pls let me know..
|
|
|
|
|
|
Just for another thought, if you are using MSSQL 2000 there is a limit of 4000 characters for nvarchar (unicode 'wide' varchar) and 8000 for regular varchar.
Your string may be longer than that and as a result it gets truncated when passed to a stored procedure.
"Democracy is two wolves and a sheep voting on what to have for dinner" - Ross
Edbert
Sydney, Australia
|
|
|
|
|
I'm trying to force a window to jump to a specific row in my database when I click a button. I'm using a "details" display of the table, and there is a binding navigator(supplied with the drag and drop creation of the form).
An example would be (I'm using c# btw)
[Parts list]
1.
2.
3.
...
Select Part [2.]
New Form with more details on part 2.
Edit/Delete/New part
I can use a modified SQL query to return just the one row, but then the add/delete/new buttons dont work because the mapping is lost to the original data. I can't imagine this is something hard to do, but I've been all over the net posting for an answer and nobody has even attempted. Any help is appreciated.
|
|
|
|
|
I found this article here[^]
I've tried to follow because that sounds like my problem, so my code looks like this.
this.tbAdapter.fill(dataSet.tb);
this.dataSet.tb.select();
that still gives me record 1, instead of the one I want. What am I doing wrong?
-- modified at 16:41 Tuesday 27th June, 2006
|
|
|
|
|
Hello again PyroManiak,
I took a quick look at the code in the link you gave, and I noticed that the poster in that message was using the IndexOf function, which he said was returning -1. The way I understood his reply post with the answer was that he called select but then called IndexOf after that. This is just speculation, since I haven't tested it yet, but I wanted to ask you if you were calling IndexOf ?
If you are and it still doesn't work, could you post the rest of your code to do with loading the "edit" form?
Hope that helps.
Sincerely,
Alexander Wiseman
|
|
|
|
|
I think I've got a solution. It seems to work without problem.
myBindingSource.Position = variable;
-- modified at 19:11 Tuesday 27th June, 2006
My older post got answered in a rather rude way, thanks for not treating me like an idiot.
|
|
|
|
|
Don't suppose you know how to capture a single attribute from a row in a datagridview do you?
-- modified at 19:57 Tuesday 27th June, 2006
I'm trying things like datagridview.rows.indexof();
but it says I must give it a variable, well, if I had the variable I wouldn't need it to tell me! =P
|
|
|
|
|
|
I'm sorry, its probably just me. It is the end of the quarter and this project was dumped in my lap as a last minute deal and it wasn't planned out other then some oddball requirements. As far as a book goes, I'm been waiting to get a book on ADO.net 2.0 (Pro ADO.NET 2.0 - Sahil Malik) but they wont budget anything else until next month when the new quarter kicks in.
This is what happens when people find out a hardware engineer also has background in software development.
|
|
|
|
|
I have an app with a DAL and so far I have been calling sprocs that require no input parameters and all works fine. I now have to call a sproc with requires an input paramter. The sproc I am calling is as follows:
ALTER PROCEDURE dbo.prc_QA_SysCodes_sel_drop_fill
(
@sysCodeType as int
)
As
BEGIN
DECLARE @Err Int
SELECT
A.[SysCodeID],
A.[SysCodeDesc]
FROM
[Contract].[dbo].[QA_SysCodes] A
WHERE
A.SysCodeType = @sysCodeType
order by
A.[SortOrder],
A.[SysCodeID]
Set @Err = @@Error
RETURN @Err
End
I need to pass in the @sysCodeType but can't figure out how to pass it to the sproc. Thoughts, words of wisdom?
-- modified at 13:16 Tuesday 27th June, 2006
|
|
|
|
|
Add parameter to your procedure:
yourSP.Parameters.Add(ParamName, SqlParamType, length); //length is optional
Pass value to the param
yourSP.Parameters[ParamName].Value = ParamValue;
Sincerely,
Elina
Life is great!!!
Enjoy every moment of it!
|
|
|
|
|
Hi
I can execute single line statements against a db, no problem...
string SQLQuery = "select VERSION, DSC from exo_version where SYSTEM = 'DATABASE'";
string strConnect = "DSN="+ dbName +";UID=abc; PWD=cde";
OdbcConnection conn = new OdbcConnection(strConnect);
conn.Open();
DataSet fullSet = new DataSet();
OdbcDataAdapter dataAdapter = new OdbcDataAdapter();
OdbcCommandBuilder commandBuilder = new OdbcCommandBuilder(dataAdapter);
dataAdapter.SelectCommand = new OdbcCommand(SQLQuery, conn);
dataAdapter.Fill(fullSet);
Cache["dbVersion"] = fullSet;
but my client wants a web based front end developing where the user can dump a load of statements in one big text block, select the DB and the server to execute them.
The 'old' way of doing this was to open up PLSQL, paste the script into a command window and execute. I could parse the text for the semicolon and process each line independantly, but is there a way to throw a whole script, which will include inserts, deleted, modification of schema, index creation etc at the database in one go?....and then capture the output!!
Any info at all on this would be appreciated.
Regards
Angel
*********************************************
The sooner you fall behind, the longer you have to catch up.
|
|
|
|
|
Need help on how to integrate data from one database-1 to the other database-2 using sql... event w/w/out knowing the fields of the other database-2.
Thanks
|
|
|
|
|
You need to know what the fields are in the other database.
|
|
|
|
|
|
|
What do you mean technology? I'm writing this in C# using the data adapters and all that built into the IDE.
|
|
|
|
|
|
I know that isn't really much help to you - but your query shows your skill level and the answer pitched at that skill level is too long for a forum response.
My general advice is to not rely on wizards and binding until you understand how database interaction works. Then you can decide if wizards and binding are for you (I rejected them because they push me in to really bad designs - they are great for quick demos are conferences to woo the managers, but as a serious tool there is a long way to go yet.)
I'd say that the best advice for you is to get a book on ADO.NET and find out how database interaction actually works rather than rely on wizards and binding.
As a high level answer:
PyroManiak wrote: new form loads (should be on current record, not record 1 which requires the user to navigate back and forth to find the right item.)
From your list box you will know what row you picked. You can use that information when populating the new form in order to get the correct row from the database. I don't know where these back and forward buttons come from. I'd guess it is some crazy wizard (hateful things so they are) that did that for you because it would require a fair bit of skill to write that sort of functionality - based on your question I'm guessing that is currently beyond your ken at the moment.
PyroManiak wrote: I can't figure out how to do this without editing the SQL query to accept a parameter.
I'm assuming you mean parameter on the query - You will always need that if you want only one specific row. The parameter (or parameters) will define the value of the primary key for the row that you want. There is no way of getting around that unless you plan to pull across the entire table (and that is a waste of memory and network bandwidth)
Scottish Developers events:
* .NET debugging, tracing and instrumentation by Duncan Edwards Jones and Code Coverage in .NET by Craig Murphy
* Developer Day Scotland: are you interested in speaking or attending?
My: Website | Blog
|
|
|
|
|
What I meant by using a parameter is if I search for "part A" when the new form opens, it only populates the datatable with part a being record 1/1. This doesn't help me when I'm trying to add a new record or delete the current record because the actual table row is n/###.
I'd appreciate an answer reguardless of how complicated it is. I understand the basics of ADO.NET, but that doesn't help when a function I'm looking for doesn't exist by any means I'd think to look for it. Thats no better then asking someone to make a Caesar Salad dressing, and having them screw it up because they didn't know to include anchovy paste, its not their fault for not knowing what isn't there, but that also doesn't mean that they are clueless in cooking.
|
|
|
|
|
I found what I was looking for... there is a .position for the bindingsource and I was able to pass my variable to it and everything works now.
Was that really going to be such a hard answer?
|
|
|
|