|
plz
I am trying to fetch 1,50,000 records from
the DataTable and dataTable.Rows.Count returns
an integer so it gets index out of bound.
tell me the way to find the no records
in the DataTable which can return a long
value.
Piyus Gupta
|
|
|
|
|
Why do you need to fetch so much records at once? DataTable.Rows.Count returns integer and its maximum value is 2,147,483,647 so it should be enough for your case
|
|
|
|
|
Consider using a DataReader instead.
|
|
|
|
|
hi all
i need to find members whose age is greater 75 yrs.how to calculate age from the give DOB.
I used the following code.
DOB <= Dateadd(yy,-75,getdate())
Plz help me to find out the correct way
thanks in advance
cheers
sangeet
|
|
|
|
|
select * FROM
WHERE datediff(year,convert(datetime,DATEOFBIRTH),getdate())>75
-- modified at 8:17 Wednesday 19th September, 2007
|
|
|
|
|
Hi,
Can any1 pls tell me if it is possible to place a textbox on the body of a report so that it appears on evry page of the report when a page break occurs, i am not supposed to use the page footer part to accomplish this & also there are no groups. i require the textbox to be in the body section itself. Please also let me know how to detect when a pg. break is going to occur in the rdl file(if it is possible)
Thanks
|
|
|
|
|
You can just place your textbox at the top of the body section of your report. When the report renders, the textbox will be displayed at the top of each page.
Why do you need to know when a page break occurs? If you need to explicitly force a page break somewhere in the report, you can do this. Otherwise, page break positions are going to be dependent on local user settings and you won't have any control over where they occur.
Regards
Paul
|
|
|
|
|
Hi,
actually the requirement is that i am required to display the page total for every page without using the header or the footer section. Placing a textbox at the top of the body of the report doesnt display it on all the pages, futhermore the repeat item with dataregion on each page option doesnt work. i have read that this problem goes away when we publish the reports onto a report server. but we are not going to publish them onto a server they are going to be local reports.
i wanted to know how the page break occurs to figure out if there is a way to insert the required value before it happens
Thanks.
|
|
|
|
|
What does your report do? Does it contain a table object that displays a set of tabular data? In that case, add a footer section to your table object, put your textbox in the table footer and set the footer to repeat on every page via the table properties.
Paul
|
|
|
|
|
i am looking for a general solution, the report may contain a table object or a list to display the data thats not a prob. Adding textbox on the footer to display the sum and making it repeat on every page will not solve the problem, bcos the final total will be displayed on each page and not the individual page total. i'm not really sure if its possible to achieve this without using the page footer....i hope there is a change in the requirement
|
|
|
|
|
i am developing an application in ASP.net,i am using the following sql query, but in SQL Server "criminal" table i want the same record to be inserted, so can anyone tell me how to merge the two queries in one query so that only one row is inserted
strQuery = "INSERT INTO criminal(cr_name,no_times,cr_desc,cr_pic,fing_print)VALUES('" + textBox1.Text + "','" + textBox5.Text + "','" + textBox4.Text + "','" + textBox6.Text + "','" + textBox7.Text + "')";
strQuery = "INSERT INTO criminal(pic_name) SELECT substring(cr_pic,11,30) FROM criminal";
|
|
|
|
|
Try this
strQuery = "INSERT INTO criminal(cr_name,no_times,cr_desc,cr_pic,fing_print,pic_name)VALUES('" + textBox1.Text + "','" + textBox5.Text + "','" + textBox4.Text + "','" + textBox6.Text + "','" + textBox7.Text + "','" + substring(textBox6.Text,11,30)+"')";
|
|
|
|
|
i had tried the same query but the following error comes
Error 14 The name 'substring' does not exist in the current context C:\Documents and Settings\mehwish\My Documents\Visual Studio 2005\Projects\rescue15\new_wanted_criminal_record.cs 654 230 rescue15
|
|
|
|
|
Check if this works out
strQuery = "INSERT INTO criminal(cr_name,no_times,cr_desc,cr_pic,fing_print,pic_name)VALUES('" + textBox1.Text + "','" + textBox5.Text + "','" + textBox4.Text + "','" + textBox6.Text + "','" + textBox7.Text + "','" + textBox6.Text.Substring(11,30) +"')";
|
|
|
|
|
again error comes. Error is
ArgumentOutOfrangeException was unhandled
Index and length must refer to a location within the string.
Parameter name: length
what do i do
|
|
|
|
|
you are getting that error bcos the length that u are specifying is greater than the no of the characters in the string. make sure that you are specifying the right parameters in order to extract the name for the pic...try this
strQuery = "INSERT INTO criminal(cr_name,no_times,cr_desc,cr_pic,fing_print,pic_name)VALUES('" + textBox1.Text + "','" + textBox5.Text + "','" + textBox4.Text + "','" + textBox6.Text + "','" + textBox7.Text + "','" + textBox6.Text.Substring(11,textBox6.Text.Length-11) +"')";
i am assuming that the cr_pic name starts from the 11th position and u want it till the end. if you are still having a problem the post the format in which you are specifying the cr_pic
|
|
|
|
|
thank you this is really working, can u suggest the solution for one more problem
string strQuery = "";
openFileDialog1.ShowDialog();
string s = openFileDialog1.FileName;
textBox6.Text = s;
string st = "Pict" + Guid.NewGuid().ToString() + ".jpg";
File.Copy(openFileDialog1.FileName, Path.Combine(@"c:\inetpub\wwwroot\15 website\images", st));
strQuery = "INSERT INTO criminal(pic_name) VALUES(System.IO.Path.GetFileName(openFileDialog1.FileName))";
PROBLEM:
error comes on this the SQL Query , am i inserting rightly?
|
|
|
|
|
ya mavii
u have tried to fetch the char in the string at
the position outside the string
Use the "IndexOf" fun keeping in
mind that it starts from 0 and end at Length-1.
Regards
_________
Piyus Gupta
|
|
|
|
|
Pardon me if i'm missunderstood,
but those two queries is tend to insert different value to the table, so what is the reason you should merge them into one query??
maybe you could execute only one query by your application code , such as
if xxx = "true" then
strQuery = "INSERT INTO criminal(cr_name,no_times,cr_desc,cr_pic,fing_print)VALUES('" + textBox1.Text + "','" + textBox5.Text + "','" + textBox4.Text + "','" + textBox6.Text + "','" + textBox7.Text + "')";
else
strQuery = "INSERT INTO criminal(pic_name) SELECT substring(cr_pic,11,30) FROM criminal";
end if
|
|
|
|
|
i cant apply if because i want to insert one record which includes the columns in both queries, actually i want some solution to insert cr_name,no_times,cr_desc,cr_pic,fing_print,pic_name
using one query not two separate SQL quries
i want one row to be inserted
|
|
|
|
|
1 - try reading the post on how to ask questions
2 - try using parameterised queries, so you're not open to injecton attacks
3 - try using real variable names, so your code is readable
What was the question ?
The most logical way I can see to do this, is to drop a column which always contains a substring of a value in another column, that's just duplicaton of data. Work out the pic name from the path in code, or write a proc that returns it as seperate data, but based entirely on the one column that contains all the data you need.
OR, a yucky way to do it that would at least work, would be to store the Id of the column in question, and then update ony that, instead of doing an insert, which is obviously not what you want.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
STRQRY="INSERT INTO criminal
SELECT '" + textBox1.Text + "','" + textBox5.Text + "','" + textBox4.Text + "','" + textBox6.Text + "','" + textBox7.Text + "'
substring(cr_pic,11,30) FROM criminal
"
|
|
|
|
|
Other people have already answered the questions for you but I feel the need to weigh in on your architecture a little bit.
1. You really shouldn't rely on the default names that you get in Visual Studio. Consider renaming textBox1, et al, to more meaningful names.
2. Don't create direct SQL strings like this. This is bad bad practice which should be avoided at all costs because you have opened your code up to SQL Injection attacks. See this[^] article for more information.
3. Consider moving your data access logic into a separate data access layer (DAL).
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hi all, this is my first post here.
I want to know if there is any chance to create a report using SQL 2005 Report Service to mimic the Data-Auto Filter tool in Ms Excel. In this case, i want to create in matrix report.Let's say I have a dataset using this query :
select p.Proj_ID, p.Division_ID, p.Division_Desc, p.Department_ID,
p.Department_Desc, p.Type
from project p
left join Mill m on p.mill = m.org_area
I have create a matric report, with
P.Type in Row Area,
Division_Desc in Column area and below Division_Desc I have group base on Departemen_Desc.
Proj_ID in Data Area.
I want to create something like combo box in the report column header to choose witch Division to shown.
Is there any possible way to create such thing?
Thanx for any information.
|
|
|
|
|
i want to read XML file from sql server 2005. Is there any stored procedure that can read xml file data and store the values in table?
|
|
|
|
|