|
DECLARE @MyTitle varchar(50),
@ytd int
SET @MyTitle = 'Some Title'
EXEC dbo.YtdSales @MyTitle, @ytd OUTPUT
SELECT @ytd
All you have to do is specify (again) that the parameter in the stored proc you are calling is an output parameter.
|
|
|
|
|
I am not sure if this is going to work but figure I mine as well try. I have a query that returns 2 columns and x rows. What I want to do is join simalar rows into the columns but not sure how I can get it done....
Example
Id Price
7812 25
7812 34
7813 67
7813 32
What I want to do is have the rows with the same Id show the 2 prices in the same row. Is this at all possible?
Thanks for all of your help!
There are 10 kinds of people in this world. Those who understand binary and those who don't.
We shouldn't assume something's debugged just because everyone in the whole world has access to the source code.
|
|
|
|
|
Only manually. Add prices as strings with separator ... use hashtable as intermediate
Hashtable ht=new Hashtable(1);
foreach(DataRow dr in myTable.Rows)
if(ht.Contains(dr["id"])
ht[dr["id"]]=ht[dr["id"]].ToString()+","+dr["price"].ToString();
else
ht.Add(dr["id"],dr["price"].ToString();
Next, clear DataTable and copy Hashtable into it. Not tested
Hi,
AW
|
|
|
|
|
I've been trying to cut my teeth on writing applications that read/write/query databases for some time now. In the past, I have used MS-Access to learn the basics of database theory and I have a pretty good handle on it: Tables, keys, normalization, joins, queries, etc - all using the SQL command window that Access provides. I don't have any problem with any of that.
However, when I attempt to use C# or MFC to get at my Access file, all hell breaks loose. My immediate problem is:
What must I do to gain access to my Access database file from an MFC or C# program? What drivers and connections must I set up - and how? I'm using Windows XP-Pro. I have found the ODBC Data Sources icon under the Administration Tools in Control Panel but I am absolutely stupified by the complexity of this and the bottom line is that I can't get it to work.
My problem in broader terms is that I can never find an explanation - for humans - that de-mystifies all of this database technology. It seems I have seveal database drivers installed on my system and I have no idea how they got there and I have no idea what to do with them. Invariably, when I consult somebody that understands databases, they start spouting all kinds of abbreviations, acronyms, jargon and terms that really make no sense to somebody who is starting out. I have done a thorough search of internet resources, books, etc... I find nothing helpful.
Some advice to solve my immediate problem would be appreciated. Some advise to solve my broader difficulties would earn a place in my will.
Thank you,
Jethro
|
|
|
|
|
Hi there,
I'm trying to modify data in SQL Server usin ADO
The followin code fails in windows 98
_CommandPtr pCommand;
pCommand.CreateInstance(__uuidof (Command))
Any idea why?
Thanks kumar
|
|
|
|
|
In Visual Studio.Net2003 on Report Layout
after execute my store procedure , we have data like this :
Sample Data Chart Of Account (COA) Code and Description.
'100000' -> Header | '100000' INCOME
'110000' -> sub Header | '110000' OTHER INCOME
'110001' ---> detail | '110001' Other Income Branch 15750
----> there is Sub Total | Sub Total Other Income 15750
'120000' -> sub Header | '120000' INTEREST
'120001' ---> detail | '120001' Interest from Bank 12500
'121001' ---> detail | '121001' Interest from Stock Market 07500
----> there is Sub Total | Sub Total Interest 20000
'200000' -> Header | '200000' EXPENSE
'210000' -> sub Header | '210000' Expense from Allowance 10550
'210001' ---> detail | '210001' Expense from Overtime 08450
----> there is Sub Total | Sub Total Expense 19000
-finally there is Grand Total | Grand Total (15750+20000-19000) 16750
(INCOME - EXPENSE)
in PowerBuilder if we want to compare data record we can use llike this :
if name1 <> name1 (-1) then..... --> this mean we compare current recorod with previous record
i tried this :
=iif(Fields!COA.code.value.sbstring(0,1) <> Fields!COA.code.value.sbstring(0,1)(-1), '...', '<else>'
but it doesn't correct
how do i compare between COA code 100000 with 1100000 in Visual Studio.Net 2003 with or without using Grouping Function ? (especially between first digit and the second digit)
and what is the correct syntax ?
email : sukasukabo@hotmail.com
|
|
|
|
|
I Prepared One Table with Selected Rows from another Table.
These Two tables have same schema. But Problem is i do Some
modifications in this Table. i want send this rows back to the original datatable.but that table already contains these
rows. so i have to update these rows. can anyone help me with a simple solution. Thanks in advance.
|
|
|
|
|
Hi,
u can merge two table using Dataset's Merge method as...........
Let ur original table is dtTable and ur filtered table is dtTemp.
dsNewData = New DataSet()
dsNewData.Tables.Add(pi_dtTable)
Dim dcCol(0) As DataColumn
dcCol(0) = pi_dtTable.Columns("emp_id")
pi_dtTable.PrimaryKey = dcCol
Dim dcCol1(0) As DataColumn
dcCol1(0) = dtTemp.Columns("emp_id")
dtTemp.PrimaryKey = dcCol1
dtTemp.TableName = pi_dtTable.TableName
dsNewData.Merge(dtTemp, False, MissingSchemaAction.Ignore)
I hope this will help u..............:->
Regards,
Ritesh
|
|
|
|
|
hye
i'm tring to read meta tag that contains name="KeyWords" content="something"
the query is : select DocKeyWords from scope()
the result = " " ....
------------------------------------------
i have in the same html file title tag , and when i read DocTitle -> the result are correct !
------------------------------------------
so why i can't read the meta tag ???
tnx a.r
|
|
|
|
|
Hi,
I want to create a custom rendering extension based on a existing rendering,
I have seen in the MSDN that it is possible but the documentation is not
complete
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/RSPROG/htm/rsp_prog_extend_security_87oi.asp
If somebody know how i can do ...
Thanks in advance...
|
|
|
|
|
Have you generated report in HTML format, If so before writing Binary converted data to Response, make the Content type as
"application/PDF" for PDF or "application/vnd.ms-excel" for EXCEL
Don't forget to pass the report format as desired type(PDF or EXCEL ) when you are Rendering the report to binary format.
For EXCEL to work Excel 10 or above is required.
Hope this helps.
Regards
JK
|
|
|
|
|
Should i use SqlConnection to connect to server before i use SqlDataAdapter to to fill the dataset ?
Example :
=============
<br />
string ConStr = "server=(local);uid=sa;pwd=password;database=NorthWind";<br />
string cmdString = "select top 3 last name, firstname, title from employees";<br />
SqlConnection conn = new SqlConnection(ConStr);<br />
SqlCommand com = new SqlCommand(cmdString,con);<br />
SqlDataAdapter da = new SqlDataAdapter(com);<br />
DataSet ds = new DataSet();<br />
<br />
conn.open();
<br />
da.Fill(ds);<br />
I try code above and i found that even without manuall open the connection i still able to fill up the dataadapter (da).
So what is the best method to fill the dataadapter with out connection first out without using connection?
|
|
|
|
|
If your connection is closed already - the DataAdapter will open the connection, perform the query, and close the connection again. If you do not need the connection open for anything else then I recommend you let the DataAdapter do the clean up for you.
[ADDITIONAL] I should add that if the connection is already open the DataAdapter will not close it [/ADDITIONAL]
If you are going to perform a series of queries one-after-the-other then I would recommend that you open the connection, perform your queries, then close the connection.
Does this help?
My: Blog | Photos | Next SQL Presentation
WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and More
|
|
|
|
|
Thanks it really help and clear all my doubt.
|
|
|
|
|
here is my problem, please help.
I am having 2 databases namely employees and projects.
employees database contains a table emp (with fields like empname, etc).
projects database contains a table prj (with fields like prjname, prj_leader, etc).
but i want to ensure that ALL the prj_leader entries MUST be existing empnames of emp table in employees database.
i know that if both the tables are in the same database, it is simple. but i have no idea whether we can set such foreign key constraints across databases.
kindly suggest.
|
|
|
|
|
I’m afraid, its not possible. But,you can use Procedure to ensure this.
With regards,
Nazmul Hassan Hirok
|
|
|
|
|
I've been working on this little Windows Forms app. that manages data using a DataGrid. Up until now I've only tested it with small datasets (it connects to an Access Database (and yes, there is a reason for not using MSDE)). Everything has been fine until I finally got the real, official data put together (it was comprised of 5 spreadsheets, all in different formats, with no validation ) and plugged it in for the first time.
I cannot believe how slow it is now . The DataAdapter's Fill method is taking anywhere from 20 to 40 seconds to load the dataset with the 26000 records. Obviously the solution is to only grab the data I need to fill the current view and then intercept the applicable scroll events and re-fill the data as necessary (similar to paging with the web version). I'm about to embark on that but I'm wondering: is this all really necessary? It seems like something that should be built into the framework. Needless to say I don't want to reinvent the wheel so if someone knows what I'm missing, could you enlighten me please?
I've looked at virtually every example I can find and they all say that the Fill method is slow and offer a couple of tips for speeding it up: using the overridden Fill method that accepts a start and row count is one. Nobody bothers to go into any more detail than just mentioning it, however.
Thanks in advance.
Cheers,
Drew.
|
|
|
|
|
Did you try SqlDataReader?
If you are using DataGrids should be the fastest way.
Cheers
Al
|
|
|
|
|
I have a need to pack 8 seperate datasets into one of 9 arrays for population in a tree control. Is this possible? if not what would be the best way to accomplish this? I am accessing 5-6 fields from seperate tables for each ds and need to aggregate them at a later point!
My end goal will have 9 nodes in a tree, using the first ds as one node and branch the the rest in sequential order.
Thought / Suggestions?
Thanks;
David @ Premier
You are only as good as your last project.
|
|
|
|
|
hi,
I am having 2 databases namely employees and projects.
employees database contains a table emp (with fields like empname, etc)
projects database contains a table prj (with fields like prjname, prj_leader, etc).
but i want to ensure that ALL the prj_leader entries MUST be existing empnames of emp table in employees database.
i know that if both the tables are in the same database, it is simple. but i have no idea whether we can set such foreign key constraints across databases.
kindly suggest.
|
|
|
|
|
hi
I have got a table as follows
col1 col2
---- -------
1 1183.74
2 1188.05
3 1202.08
4 1211.92
5 1213.55
6 1213.45
7 1213.54
8 1204.92
9 1210.13
10 1209.57
11 1205.45
12 1194.65
13 1194.22
14 1203.21
15 1205.72
16 1203.38
17 1198.68
18 1188
19 1189.24
20 1182.81
21 1177.07
22 1190.25
23 1191.17
now i want a query which yields the following results
here col3 for record 1 is calculated as follows
(1188.08/1183.74)-1)*100=0.364100225
col1 col2 col3
---- ---- ----------------
1 1183.74 0.364100225
2 1188.05 1.180926729
3 1202.08 0.818581126
4 1211.92 0.134497327
5 1213.55 -0.008240287
6 1213.45 0.007416869
7 1213.54 -0.710318572
8 1204.92 0.432393852
9 1210.13 -0.04627602
10 1209.57 -0.340616913
11 1205.45 -0.89593098
12 1194.65 -0.035993806
13 1194.22 0.752792618
14 1203.21 0.208608639
15 1205.72 -0.19407491
16 1203.38 -0.390566571
17 1198.68 -0.890980078
18 1188 0.104377104
19 1189.24 -0.540681444
20 1182.81 -0.485285042
21 1177.07 1.119729498
22 1190.25 0.077294686
23 1191.17
|
|
|
|
|
Looks like homework...
Wout Louwers
|
|
|
|
|
hi
I want to know how to communicate with database over the internet. What type of encrypting should I use.
shelly
|
|
|
|
|
Although it is possible (if your firewall allows it) I wouldn't really recommend it. You can, of course, connect via a VPN which would make it appear as if it is on a local network. VPN software will encrypt the data for you.
If the communication is at an application level I would suggest looking into creating a web service to communicate with the database. This uses HTTP (so you can use HTTPS) and also it means that you define exactly the type of queries that can be run by virtue of the web methods that you expose.
My: Blog | Photos | Next SQL Presentation
WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and More
|
|
|
|
|
Hello,
Please advise on how I might be able to make this sproc work...
declare @TrainerID int
select TrainerID, LastName, FirstName, City, State, Country, r.code, l.description, p.Code from trainers as t
inner join Regions as r
on t.region = r.regionid
inner join Languages as l
on t.Language1 = l.LangID
--and t.Language2 = l.LangID
--and t.Language3 = l.LangID
inner join products as p
on t.product1 = p.ProductID
--on t.product2 = p.ProductID
--on t.product3 = p.ProductID
--on t.product4 = p.ProductID
where TrainerID = @TrainerID
The situation is that I have designed in the Trainers (t) table multiple columns of Languages and Products with properties as Int which stores values based on their respective LanguageID and ProductID from the Languages and Products (definition) table.
The dilemma is on the result, I would like to see the actual codes and not the ID key of each of the multiple columns coming from the definition tables.
Thanks
Jay
Feng Screwed - the art of moving to a new place because the old place is just too messy to clean.
|
|
|
|