|
Hello,
I am trying to write a procedure that does the following. I currently have the user enter data in a textbox that populates a cbo. When they select data in the cbo it populates a listbox. I want the user to be able to take the items checked in a listbox and rename them. The data originated from what the user put in(batchno). So I want to be able to take the selected items in the textbox and rename a new "batchno" but leave the ones that were not selected. Thank you for your help.
Michael
|
|
|
|
|
I'm having trouble setting a table with 2 primary keys. I get an error saying Primary Key already exists. I'm using ADOX with C++.
Thanks
|
|
|
|
|
Anthony9887 wrote:
2 primary keys
Reading your post, I'm wondering if you did as well.
'Primary' implies one, so how can you have two?
I think what you might be confusing here are indexes and keys. You can define many indexes for a table, but you can only define one primary key.
Chris Meech
"what makes CP different is the people and sense of community, things people will only discover if they join up and join in." Christian Graus Nov 14, 2002.
"And when you need to hire a programmer to do mostly VB programming, it's not good enough to hire a VB programmer, because they will get completely stuck in tar every time the VB abstraction leaks." Joel on Software Nov 11, 2002.
|
|
|
|
|
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
|
|
|
|