|
Further to Chris' reply, what you're probably really trying to do is define a primary key that consists of multiple columns. Which is perfectly allowed and acceptable.
#include <beer.h>
|
|
|
|
|
i made an app that uses MDI enviorment.
i want to be able to access the same DataSet from all of the child forms.
how can i do that?
-- Directly From Zion --
------ Haimon15 ------
|
|
|
|
|
This is not really an SQL/ADO/ADO.NET question, but anyway...
There are a couple of approaches:
1. Declare your DataSet as a public in your MDI parent. In your child windows you use the this.MdiParent property to access your parent window.
Sample code:
<br />
public class MyChildForm : System.Windows.Forms.Form<br />
{<br />
private DataSet myDataset<br />
{<br />
get<br />
{<br />
MyParentForm mdiParent = this.MdiParent;<br />
return mdiParent.myDataset;<br />
}<br />
}<br />
}<br />
<br />
public class MyParentForm : System.Windows.Forms.Form<br />
{<br />
private DataSet myDataset;<br />
}
Now, in your MdiChild you access your dataset by using the MyDataSet property.
You can now insert the abstract keyword in the definition of MyChildForm, and make all your actual mdi child forms inherit the MyChildForm abstract class instead of System.Windows.Forms.Form. Then the MyDataSet property will be available withot anymore work...
2. You could create a class with a static DataSet member... (Or a singleton class)
Then that dataset would be available all over the application...
|
|
|
|
|
hi all
I have one store procedure and I want that how to get parameters in this store and put to table with SQL command
ex : myStore(@param1, @param2,@param3...)
use sql and return name column
index name
1 @param1
2 @param2
3 @param3
... .....
somebodys can help me, please.
thanks !!!
nhoc ti`
|
|
|
|
|
D,
If I am understanding you correctly you trying to do a basic insert stored proc.
CREATE PROCEDURE dbo.insertdata
(
@param1 varchar(50),
@param2 varchar(50),
@param3 varchar(50),
)
AS
BEGIN
INSERT INTO databasname
VALUES (@param1, @param2, @param3)
END
GO
What application are you using to insert the data? ASP,ASP.NET or Windows Form!
HTH
Tony
|
|
|
|
|
oh no, I want GET ALL PARAMETER NAME in this store procedure
|
|
|
|
|
You can use sp_procedure_params_rowset 'your_procedurename_here' .
It returns a rowset containing the names, types and other info on the parameters that you procedure takes.
This is the SP that is used by MS in their Data Access Application Blocks (DAAB) for .NET and in earlier versions of ADO.
|
|
|
|
|
|
I have these fields that I need to search in the database.
Name 50, Description 255, Code 8000, Notes 2000
for a user defined value.
Does anyone know a site that has good info on doing complex
searches in a database. Preferably how to build the Query string.
Thank You
Bo Hunter
|
|
|
|
|
|
You might find the LIKE operator useful for picking up specific terms:
<br />
select * from Table where Description LIKE '% term %'<br />
will find anything with " term " in (I've added spaces to pick up the complete word)
--
Ian Darling
|
|
|
|
|
Adding spaces can help to isolate the complete word but it won't (for example) pick up the word "sentence" in this sentence.
|
|
|
|
|
True, but I thought I made that reasonably clear - the code was illustrative, not complete. You could modify the LIKE clause to handle those cases.
--
Ian Darling
|
|
|
|
|
Do I need to call AddRef() when I assign one Connection pointer object to the other? or Do I just need to call "=" operator, nothing else?
eg: _ConnectionPtr pCn1,
pCn2;
//create instance for both pCn1 and pCn2
//pCn1 open connection
pCn2 = pCn1; //is just it, no need anything else?
//do I need to call AddRef() here?
I want to have just one Connection to Database to conserve DbServer's resource.
Do I need to call Release() or can I just set the pointer to NULL? I read somewhere that smartpointer supposedly call release() everytime we set the pointer to NULL. Is this true?
Is _RecordsetPtr the same thing as Connection pointer (same Qs as above but replace Conn with Recordset)?
How about _FieldPtr?
cheers,
Jo
|
|
|
|
|
Hi,
I'm working on a remoting project with Visual Studio .NET. What I want is, to build the ReportDocument on the server (so the dataset is filled, attached to the ReportDocument and also the rpt file is read server-side); and then to send the ReportDocument to the client and attach it there to the crystalreportviewer.
However, because ReportDocument is nog serializable, this is not possible.
Is there a way that I can build the report server-side (filling dataset, attaching to rpt) and then send the result to the client? I don't want to distribute the rpt files to the client...
|
|
|
|
|
Hi. This is my first attempt at a stored procedure. Ok, I have three columns (name, date, cost) in my table called inventory. I am trying to find a way of getting the following out:
If the date is less than 12 months to the current date, then output a new column with cost/12
else it should be divided by 3.
Basically the output I am trying to get is:
Name Date Cost AdjCost
Please help if you can
|
|
|
|
|
This sounds like a candidate for a user defined function.
eg:
select Name, Date, Cost, dbo.adjust(Cost, Date) from inventory
where adjuct() is the function, and the SQL code is your stored procedures contents.
--
Ian Darling
|
|
|
|
|
create procedure GetAdjCost
AS
select
Name,
Date,
Cost,
case
when DateDiff(mm,Date,GetDate()) < 12 then Cost / 12
else Cost / 3
end 'AdjCost'
from
Inventory
Hope this helps..
onwards and upwards...
|
|
|
|
|
I'm having troubles setting the field to Allow Zero Length to True using ADO for C++. Any ideas or code samples?
Thanks
|
|
|
|
|
|
|
i have a problem i have a vb6 program which at one point calls a stored procedure that accepts two strings as arguments but there are certain times when on of the strings contains a ' for example
execute mystoredproc 'blahblah', 'jame's'
this of course generates an error because it thinks that the letters jame is the whole string being submitted so how can i change this so it accepts it
|
|
|
|
|
DX,
It sounds like your string in VB is reading the special character as the beginning of a comment. ie: ' Comments go here.
I don't know of a workaround for this, I have had the same problem with ASP Pages doing data inserts into SQL Server.
Tony
|
|
|
|
|
no its not vb that has the problem its doesnt think its a comment its when its submitted to the stored procedure that it gets the problem
like the stored procedure would accept this
execute mystoreproc 'blah','blah'
no problem
but when you have something like this
execute mystoreproc 'blah's','blah'
the stored proc will interpet it like this
execute mystoreproc 'blah' s ,'blah'
because sql uses the ' character to enclose strings that are inserted or otherwise used in queries
|
|
|
|
|
i found the solution if you want to use something like
'jake's bigtime' in an insert statement then you would have to simply put two apostrophies and sql will then put the one apostrophe character in the db
so the query would look like this
insert into test values('jake''s bigtime')
and a this query select * from test
would return
jake's bigtime
|
|
|
|