|
public void Show_Categories()
{
MainPage obj = new MainPage();
SQLiteCommand myCMD1 = new SQLiteCommand (ShowCatName_Query , myConnection);
myConnection.Open();
SQLiteDataReader myDR = myCMD1.ExecuteReader();
ToolStripMenuItem Items = new ToolStripMenuItem();
while (myDR.Read())
{
Items = new ToolStripMenuItem();
Items.Name = myDR["Name"].ToString();
Items.Tag = myDR["Name"].ToString();
Items.Text = myDR["Name"].ToString();
Items.Click += new EventHandler(obj.Categories_DropDownItem_Clicked);
this._myCats.DropDownItems.Add(Items);
}
myConnection.Close();
}
//---------------------------------------------------------
public void Categories_DropDownItem_Clicked(object sender, EventArgs e)
{
ToolStripMenuItem ClickedItem = (ToolStripMenuItem)sender;
MessageBox.Show(ClickedItem.Text);
}
|
|
|
|
|
hi forum
any body can tell me how to chat between two or more systems using sockets(windows).in my case firewall can not be off.
thanking you in advance;P
|
|
|
|
|
Too vague - Be more specific about what you want.
|
|
|
|
|
Dear Jacob Klint
May you please tell me how to sign the volume meter you have created and implemented in my project? I got the demo project but that doesn't show how it is implemented and the source code for the demo is not available. After all the progressbar is not signed therefore gives a lot of problem using it. Please help me.
Siamginsuan Ngaihte
|
|
|
|
|
If this is a question related to a CP article, post it in the articles message board (situated at the bottom).
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
please tell me how can i export datagrid into excel in winform in C#
please remmember WinForm cause all what i found about WebForm and thanks a lot for your effort......
|
|
|
|
|
In earlier, you'd have had to disassemble Excel to parse its format, but that's long gone in databse world -with very few exceptions-.
You've got two ways:
1- The easy -most effecient- way is to export your data to an intermediary format that could be understood by most Database engines -including Excel-. For example Xml or Html files, or comma/tab delimited text files.
2- The hard way -and I wouldn't know why would anybody go there anymore. There could be some good reasons that I don'y know of though-, is to use Excel Interop -which presumes that MS Excel is already installed on the user's machine. You'd find more derails about this way in Office Interop library documentaion.
Regards
|
|
|
|
|
There is a third party library available somewhere called RKLib.ExportData that can export straight to .xls, but the previouse reply was right, doing csv or xml is easier and more flexible.
|
|
|
|
|
Hi Sir and Madam.
How to know MS Office System Color
Thank You.
|
|
|
|
|
???
|
|
|
|
|
|
Hello Friends
Can someone help me.
I know how to read value using SqlHelper.ExecuteReader using storedProcedure.
But if stored Procedure has a output parameter, I'm not able to read output parameter value.
How to read output parameter value.
I could read output parameter value using SqlHelper.ExecuteNonQuery, but then I'm not able
to read database query column values.
how to read database query column values.
pls help soon
Regards
Balasaheb
Balasaheb
Software Developer
Platform: Asp.net,vb.net
Database: SQL Server 2000
|
|
|
|
|
Create a paramter object, set the direction to output and add it to the command object (but keep the reference to the parameter object). After you have closed the data reader, you can access the output value in the parameter object.
---
b { font-weight: normal; }
|
|
|
|
|
Thanks for ur reply
In case of ExecuteReader:-
My stored procedure contains two result set
The actual format of stored procedure is
***************************Stored Procedure start*************************************
declare @colid1 int
declare @col2 uniqueidentifire
declare @Status out
set @col1 = "001"
set @col2 = "{123456789}"
declare @id int
select @id = (select id from tableid where colid = @colid1)
Select col1,col2,col3,col4 from tabel where col1 = @colid1 and col2= @col2
if (exists(select col1,col2 from table2 where col1 = @col1 and col2 = @colid))
{
@Status = 1
}
else
{
@Status =0
}
select @Status as status
*****************************Stored Procedure End****************************************
The above stored procedure is given for reference.
Now my problem is
I'm able to retreive column values using ExecuteReader by passing stored procedure properly
ReaderObj = SqlHelper.ExecuteReader(Pass parameters)
ReaderObj retreives only table1 columns values.......now how to read @Status value(look at above stored procedure)
*****************************************************
arParams[0] = new SqlParameter("@prref",SqlDbType.VarChar,20);
arParams[0].Value = strPrjRef;
arParams[1] = new SqlParameter("@userid",SqlDbType.UniqueIdentifier);
arParams[1].Value = new Guid("{7126886d-2538-429c-ab3c-22b3341dcecf}");
arParams[2] = new SqlParameter("@STATUS", SqlDbType.Int);
arParams[2].Direction = ParameterDirection.Output;
RdPrjDetails = SqlHelper.ExecuteReaderconnstr,CommandType.StoredProcedure, "GET_PROJECT_DETAILS_SP", arParams);
*******************************************************
Pls help me in this regard
Balasaheb
Software Developer
Platform: Asp.net,vb.net
Database: SQL Server 2000
|
|
|
|
|
Ok, so you are not using an output parameter at all?
It's a bit hard to tell, as the stored procedure that you show is lacking the entire declaration part. It's hard to say what parameters you should use in the calling code if you don't show what parameters the stored procedure uses.
Also the stored procedure contains some errors that tells me that this is not the code that you are actually using. If you only show me some made up code, I can only give advice on that code, not on the code that you are actually using.
It's like if you went to your car mechanic and said: "I've brough my bike. Can you take a look at it and tell me what's wrong with my car?"
If you have a query that returns more than one result, use the NextResult method of the data reader to move from the first result to the next.
---
b { font-weight: normal; }
|
|
|
|
|
ok I'm giving u actual stored procedure, earlier stored procedure was given only for reference
The original stored procedure (working perfectly without error) is
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
ALTER PROCEDURE GET_PROJECT_DETAILS_SP
(
@prref varchar(20),
@userid uniqueidentifier,
@STATUS int output
)
As
begin
declare @prjid int
select @prjid = (select PRID from EET_PROJECTS where PRREF = @prref)
IF ((SELECT PRISPATT FROM EET_PROJECTS WHERE PRID = @prjid) = 0)
BEGIN
Select P.PRID as PRID,
P.PRREF as PRREF,
--P.PRNAME as PRNAME,
EUP.PROJECTNAME as PRNAME,
PRACTIVE = case P.PRACTIVE
when 1 then 1
else 0
end,
P.PRDESC as PRDESC,
EUP.PURCHASERNAME as PRPURCHASERNAME,
EUP.ENDUSERNAME as PRENDUSERNAME,
EUP.DESTINATION,
P.PROWNER as PROWNER,
P.PROWNLOC as PROWNLOC,
P.PRMKTLOC as PRMKTLOC,
'' as PRPATT,
EUP.INDUSTRY as PRINDUSTRY,
P.PRPROPOSAL as PRPROPOSAL,
P.PRSALES as PRSALES,
P.PRQUOTCURRENCY as PRQUOTCURRENCY,
P.CREATED_DATE as PRDATE,
CREATED_BY = (SELECT cast(FIRST_NAME + ' ' + LAST_NAME as varchar(161))
FROM EET_SEC_USERS WHERE USERID = P.CREATED_BY),
P.LAST_UPDATED_DATE as PRUP,
LAST_UPDATED_BY = (SELECT cast(FIRST_NAME + ' ' + LAST_NAME as varchar(161))
FROM EET_SEC_USERS WHERE USERID = P.LAST_UPDATED_BY),
((SELECT LOCCOUNTRY FROM EET_LOCATIONS WHERE LOCID = P.PRMKTLOC) + ' (' + P.PRMKTLOC + ')') as PRMKTLOCWITHCOUNTRY,
EUP.GP3_FLAG,
EUP.PROJECTORIGINATOR_NAME,
EUP.PROJECTLEAD_NAME,
EUP.SYS_FUNNEL_POSITION,
EUP.SYS_KOB,
EUP.SYS_PROBABILITY,
EUP.SIS_CONTENT,
EUP.SERV_FUNNEL_POSITION,
EUP.SERV_KOB,
EUP.SERV_PROBABILITY,
P.PRISPATT,
P.PRNOPATTREASON,
NULL as PRPURCHASERID,
case when P.PRUSECUSTPRICE = 1 then 'Yes'
else 'No'
end as USECUSTPRICE,
P.PRCUSTPRICEID,
(SELECT CUPRCUSTOMER
FROM EET_CUSTOMER_PRICING
WHERE CUPRID = P.PRCUSTPRICEID) as CUSTPRICENAME,
dbo.FUNC_GET_LOCATION_LIST(P.PRCUSTPRICEID) as CUSTPRICELOCN,
isnull(EUP.BOOK_DATE, getutcdate()) as PRBOOKDATE,
EUP.transitional_order as PRTRANSPRJSTATUS
from EET_PROJECTS P join EET_USER_PATT_DATA EUP on P.PRID = EUP.EUPDPROJECT
where PRID = @prjid
END
if (exists(select opuserid, opprjid from EET_MY_PROJECTS_LISTS where opuserid = @userid and opprjid = @prjid))
begin
SET @STATUS = 1
end
else
SET @STATUS = 0
select @STATUS as status
end
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
Now u able to understand what is the actual problem.
Thanks in advance
Balasaheb
Software Developer
Platform: Asp.net,vb.net
Database: SQL Server 2000
|
|
|
|
|
That's better, that stored procedure actually has an output parameter.
Why are you returning the value of @STATUS both as an output parameter and a result?
Anyway, the code that you showed earlier that created the parameter object should work just fine. After you have closed the reader, you can retrieve the value from the Value property of the parameter object. The value is returned boxed inside an object, so you have to unbox it by casting it to the type int .
---
b { font-weight: normal; }
|
|
|
|
|
ok problem has been solved using ExecuteReader.
I'm using below code to read next Resultset.
Reader = SqlHelper.ExecuteReader(pass parameters)
if !(Reader == null)
{
while(Reader.Read())
{
string str = Reader["param1"].ToString();
}
Reader.NextResult
While(Reader.read())
{
string str1 = Reader["Param2"].ToString();
}
}
Many many thanks for ur help too.
Thanks
Keep in touch
My email id:- kbalu_2001@rediffmail.com
Balasaheb
Software Developer
Platform: Asp.net,vb.net
Database: SQL Server 2000
|
|
|
|
|
Ok, but then you are not reading the value from the output parameter.
---
b { font-weight: normal; }
|
|
|
|
|
yes, no need to use output parameter.
if u know how to take value from output parameter then pls let me know.
that solution will also helpful to me
Thanks for ur help
Balasaheb
Software Developer
Platform: Asp.net,vb.net
Database: SQL Server 2000
|
|
|
|
|
Hello Guffa,
I'm not reading the value from output parameter, that is the problem
because when I write code like
string str = arParams[2].value.ToString();
it return null and fires exceprtion. I'm not able to understand what exactly happing behind the screen.
ok thanks for ur help
Balasaheb
Software Developer
Platform: Asp.net,vb.net
Database: SQL Server 2000
|
|
|
|
|
The property is named Value , not value . Other than that, the code is correct.
BalasahebK wrote: it return null and fires exceprtion
What exception does it fire? What is the error message?
---
b { font-weight: normal; }
|
|
|
|
|
now my prob. has been solved using output parameter too.
it can be possible to retreive value after reder.nextresult.
ok thanks for ur help
have nice day
bye now
Balasaheb
Software Developer
Platform: Asp.net,vb.net
Database: SQL Server 2000
|
|
|
|
|
BalasahebK wrote: I could read output parameter value using SqlHelper.ExecuteNonQuery, but then I'm not able
to read database query column values.
There is no resultset returned, hence the name, ExecuteNonQuery.
You retrieve the output param value the same way from ExecuteQuery as you do with ExecuteNonQuery.
only two letters away from being an asset
|
|
|
|
|
Thanks for ur reply
In case of ExecuteReader:-
My stored procedure contains two result set
The actual format of stored procedure is
***************************Stored Procedure start*************************************
declare @colid1 int
declare @col2 uniqueidentifire
declare @Status out
set @col1 = "001"
set @col2 = "{123456789}"
declare @id int
select @id = (select id from tableid where colid = @colid1)
Select col1,col2,col3,col4 from tabel where col1 = @colid1 and col2= @col2
if (exists(select col1,col2 from table2 where col1 = @col1 and col2 = @colid))
{
@Status = 1
}
else
{
@Status =0
}
select @Status as status
*****************************Stored Procedure End****************************************
The above stored procedure is given for reference.
Now my problem is
I'm able to retreive column values using ExecuteReader by passing stored procedure properly
ReaderObj = SqlHelper.ExecuteReader(Pass parameters)
ReaderObj retreives only table1 columns values.......now how to read @Status value(look at above stored procedure)
*****************************************************
arParams[0] = new SqlParameter("@prref",SqlDbType.VarChar,20);
arParams[0].Value = strPrjRef;
arParams[1] = new SqlParameter("@userid",SqlDbType.UniqueIdentifier);
arParams[1].Value = new Guid("{7126886d-2538-429c-ab3c-22b3341dcecf}");
arParams[2] = new SqlParameter("@STATUS", SqlDbType.Int);
arParams[2].Direction = ParameterDirection.Output;
RdPrjDetails = SqlHelper.ExecuteReaderconnstr,CommandType.StoredProcedure, "GET_PROJECT_DETAILS_SP", arParams);
*******************************************************
Pls help me in this regard
Balasaheb
Software Developer
Platform: Asp.net,vb.net
Database: SQL Server 2000
|
|
|
|
|