Click here to Skip to main content
14,640,713 members

Comments by Santosh K. Tripathi (Top 152 by date)

Santosh K. Tripathi 31-Mar-16 6:32am View
i know, it may work with 2014, but i am using 2008 :(
Santosh K. Tripathi 31-Mar-16 6:05am View
thanks for response. i just copy and paste you code.

DECLARE @tmptable TABLE (
Id int identity(1,1)
,ProductId int

still same error...

1. incorrect syntax near to 'INDEX'.
2. incorrect syntax near to 'ID'. Expecting select, or '('. -(this is after NONCLUSTERED key word).
Santosh K. Tripathi 31-Mar-16 5:59am View
Note:- due to some reason, i have to use table variable, not temp table.
Santosh K. Tripathi 31-Mar-16 5:43am View
as you told new code is

Declare @tmptable table (Id int identity(1,1) primary key ,ProductId int)
CREATE NONCLUSTERED INDEX ind1 ON @tmptable (Id, ProductId)

Now in second line
1. incorrect syntax near to '@tmptable'.

Note:- i have to use table variable, not temp table.
Santosh K. Tripathi 31-Mar-16 5:33am View
thanks for response.

1. incorrect syntax near to 'INDEX'.
2. incorrect syntax near to 'ID'. Expecting select, or '('. -(this is after NONCLUSTERED key word).
Santosh K. Tripathi 28-Mar-16 7:10am View
Santosh K. Tripathi 28-Mar-16 7:04am View
good answer. as always :)
Santosh K. Tripathi 10-Dec-15 20:30pm View
Welcome :)
Santosh K. Tripathi 10-Dec-15 3:30am View
pass value for '@CreatedBy' from you C# code.
Santosh K. Tripathi 15-Nov-15 3:55am View
catch (Exception ex)


Santosh K. Tripathi 6-Nov-15 10:04am View
why we need to raise error? example please?
Santosh K. Tripathi 6-Nov-15 10:03am View
may i know, why you want to raise error? what is purpose of this?
Santosh K. Tripathi 3-Nov-15 6:24am View
i have one doubt. if in a class i am creating 10 data set, i have to set for all of them( 10 more lines of code). is there any way to set it as default for all dataset in this class.
Santosh K. Tripathi 26-Oct-15 13:28pm View
you are again correct :)
My point is, assume if, database and application are on different server!
Network related issues.
Santosh K. Tripathi 25-Oct-15 3:52am View
you are correct.
Santosh K. Tripathi 25-Oct-15 3:48am View
one more thing making connecting to database several time is not good idea. it is very expensive.
Santosh K. Tripathi 25-Oct-15 3:47am View
:) you are correct. so my suggestion is "Member 10690878" should move whole logic in database. i mean he should use Stored Procedure.
Santosh K. Tripathi 24-Oct-15 13:54pm View
what will happen if after 1st commend, sql connection Fail?
Santosh K. Tripathi 24-Oct-15 13:51pm View
you are right. in app never delete data just mark it isDeleted = true.

and for more complex logic use stored procedure. :)
Santosh K. Tripathi 15-Sep-15 1:19am View
web config

<requestlimits maxallowedcontentlength="999999999">

<compilation debug="false" targetframework="4.0">
<sessionstate timeout="300">
<httpruntime requestvalidationmode="2.0" executiontimeout="3600" maxrequestlength="999999999">

<add key="RoleLevels" value="1,2,3,4">

<add name="XYZ" connectionstring="Data Source=xyz;Initial Catalog=;User ID=sa;Password=xyz;Connection Timeout=0;Max Pool Size = 500;Pooling = True" providername="System.Data.SqlClient">

<jsonserialization maxjsonlength="999999999">


Santosh K. Tripathi 3-Aug-15 6:14am View
thanks :)
Santosh K. Tripathi 31-Jul-15 5:09am View
Thanks. i was looking for this.

I am unable to use this class. could you help me.

My code is

MemoryStream[] arrBmpImages;
int K=0;

protected void GetPNGScreenShots()
arrBmpImages = new MemoryStream[CountdtPDF];
for (int i = 0; i < CountdtPDF; i++)
Thread_StartForImages(ref arrBmpImages);


private void Thread_StartForImages(ref MemoryStream[] arrBmpImages)
Thread m_thread = new Thread(Thread_CaptureImages);

Private void Thread_CaptureImages(ref MemoryStream[] arrBmpImages)
System.Drawing.Bitmap bmpImage;
bmpImage = // get images via

using (MemoryStream ms = new MemoryStream())
bmpImage.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
arrBmpImages[k] = ms;

Now i will use arrBmpImages[] to create PDF or PPT

How i can do it by using you code. i tried but not able to do. Please help.
Santosh K. Tripathi 29-Jul-15 12:49pm View
People who can't give any solution, they don't have right to down vote. if you are down voting, just give logic for that.
Bye the way They have there own rights to up or down vote. I know at the time of posting question few people will down vote.

if you are down voting, mean you have knowledge more than i have. But you are "A Miser" in knowledge shearing.

Share it.. :)
Santosh K. Tripathi 29-Jul-15 6:45am View
issue is solved by using .GetBuffer() Ref:-

Image image = Image.GetInstance(chartImage.GetBuffer());

Still its takes 40 seconds. i want to reduce it more. is MemoryStream[] arrBmp is good or should i use some other data structure?
Santosh K. Tripathi 29-Jul-15 5:29am View
Hi SA,

could you solve my problem.
Santosh K. Tripathi 17-Jun-15 1:14am View
Hi Pradeep, Explain you requirement for correct solution.
Santosh K. Tripathi 17-Jun-15 0:38am View
what you tried?
Santosh K. Tripathi 13-Jun-15 21:13pm View
thanks ansari
Santosh K. Tripathi 5-Jun-15 23:08pm View
Thanks for clearing concept
Santosh K. Tripathi 7-May-15 2:40am View
did you find anything? i need it.
Santosh K. Tripathi 5-May-15 4:15am View
what you have tried till now?
Santosh K. Tripathi 5-May-15 4:15am View
what you have tried till now?
Santosh K. Tripathi 5-May-15 4:15am View
what you have tried till now?
Santosh K. Tripathi 5-May-15 4:15am View
what you have tried till now?
Santosh K. Tripathi 5-May-15 4:14am View
what you have tried till now?
Santosh K. Tripathi 5-May-15 4:14am View
what you have tried till now?
Santosh K. Tripathi 31-Mar-15 6:23am View
use F12. in Elements tab search for btnGenerateInvoice and see what is its client side id. i hope it will be like XYZ_btnGenerateInvoice .

now modify
var btn = document.getElementById('<%=btnGenerateInvoice.ClientID%>');

var btn = document.getElementById('XYZ_btnGenerateInvoice');

and see what happens.

if you could find btnGenerateInvoice in element tab it means this element is not rendered client side. so you can not manipulate this element.

try and see what is happening there?
Santosh K. Tripathi 31-Mar-15 4:38am View
debug in crome
Santosh K. Tripathi 31-Mar-15 4:36am View
what you have tried till now?
Santosh K. Tripathi 31-Mar-15 4:33am View
in your code you are setting it "false". Look

btnGenerateInvoice.disabled = "false";

it should be true like this

btnGenerateInvoice.disabled = true;
Santosh K. Tripathi 31-Mar-15 3:19am View
Santosh K. Tripathi 27-Mar-15 7:02am View
Good one.

By the way, i thinks it can be more optimize, as -SA said.
Santosh K. Tripathi 27-Mar-15 0:04am View
Hi, Could you explain bit more your requirement?
Santosh K. Tripathi 25-Mar-15 13:25pm View
Hi SA,
See your answer

I am agree with your answer. i want to ask few things...

in case of a normal class, when we use new keyword and if there is no constructor is defined.
At compile time compiler insert a constructor and instantiate.

i want to know
1. for abstract class compiler doesn't insert default constructor?
2. "What is that mechanism" for abstract class which stops it to instantiate?
Santosh K. Tripathi 25-Mar-15 12:58pm View
You know meaning of locked door. just think about a person who haven't heard about lock and he just know about door!
"It is like asking why we cannot open a locked door..."

my answer would we "there is some mechanism or some arrangement is made on the door that prevents it from opening. And this arrangement or mechanism is call lock."
Santosh K. Tripathi 24-Mar-15 13:14pm View
Hi SA,

Really, I like your effort toward users and portal(codeproject).

When i reached office at 9 AM in morning, i saw you were replying to questions.
Now it is 10.30 PM , still you are giving answers.

your way of answering is also good.
I have seen few members (with 1+ M points), They leave comment on question, like a user committed a crime by asking a question.

members who, leaving such type of comments, should think few years back they also don't know about things (or don't have knowledge).By continuous learning they acquired this knowledge.
विद्या ददाति विनयं विनयाद् याति पात्रताम्। पात्रत्वाद्धनमाप्नोति धनाद्धर्मं ततः सुखम्॥
Meaning is...
"Knowledge gives humility, from humility, one attains character; From character, one acquires wealth; from wealth good deeds (righteousness) follow and then happiness"

I think instead of leaving such type comment, they should put something in there plate (at least few link) to get some knowledge on that topic.

By the way, good work man. thanks from my side for such attitude.

+5 in from me new way
:) :) :) :) :)
Santosh K. Tripathi 24-Mar-15 1:59am View
good point.
Santosh K. Tripathi 24-Mar-15 1:54am View
Reason for my vote of 5 \n very informative
Santosh K. Tripathi 24-Mar-15 0:25am View
+5 from me :)
Santosh K. Tripathi 24-Mar-15 0:02am View
come up with some example for getting help from members of codeproject.
Santosh K. Tripathi 24-Mar-15 0:00am View
Santosh K. Tripathi 23-Mar-15 23:58pm View
Santosh K. Tripathi 23-Mar-15 8:36am View
if you like answer, you should accept it as solution. The person who gave the answer feel good and he will give answer to other's questions also.
Santosh K. Tripathi 23-Mar-15 8:33am View
thanks F-ES Sitecore for reply.
today i come to know one new thing. +5 from me.
Santosh K. Tripathi 23-Mar-15 6:37am View
Santosh K. Tripathi 23-Mar-15 6:29am View
duplicate entry.
Santosh K. Tripathi 23-Mar-15 6:28am View
Explain your requirement and problem.
Santosh K. Tripathi 23-Mar-15 6:26am View
So what is issue in writing this javascript?
Santosh K. Tripathi 23-Mar-15 4:35am View
Santosh K. Tripathi 17-Mar-15 6:05am View
i would like to suggest to you "Place client side validation for txtSearchRegNo".
this will help to reduce error.
Santosh K. Tripathi 15-Mar-15 1:03am View
good one. 5+
Santosh K. Tripathi 15-Mar-15 1:01am View
Santosh K. Tripathi 15-Mar-15 0:57am View
5+ from me also.
Santosh K. Tripathi 14-Mar-15 21:29pm View
could you modify and post, above code. it will helpful.
Santosh K. Tripathi 13-Mar-15 5:56am View
-SA is correct i want to give a a suggestion you can do like this also

string strCheckValue = string.Empty;

strCheckValue += GetCheckBoxText(checkBox1);
strCheckValue += GetCheckBoxText(checkBox2);
strCheckValue += GetCheckBoxText(checkBox3);
strCheckValue += GetCheckBoxText(checkBox4);
strCheckValue += GetCheckBoxText(checkBox5);
strCheckValue += GetCheckBoxText(checkBox6);
strCheckValue += GetCheckBoxText(checkBox7);

strCheckValue = strCheckValue.TrimStart(',');

private string GetCheckBoxText(CheckBox chkBox)
string result = string.Empty;
if (chkBox.Checked)
result = chkBox.Text + ",";
return result;

Santosh K. Tripathi 13-Mar-15 5:37am View
+5 for _duDE_

error is at what line? what are values in variables in that line?
Santosh K. Tripathi 13-Mar-15 5:34am View
+5 from me.

but i'll say, give some time to Mayank to learn by debugging.
Santosh K. Tripathi 13-Mar-15 4:01am View
Santosh K. Tripathi 13-Mar-15 3:06am View
explain bit more
Santosh K. Tripathi 13-Mar-15 2:34am View
what do you want to show in each boxes if you have like this

and so on...

what are rules to show text to show in each boxes?
Santosh K. Tripathi 12-Mar-15 1:02am View
i agree with chill60.
"powerful" != "performant"
Santosh K. Tripathi 12-Mar-15 0:59am View
Thanks for reply.
Santosh K. Tripathi 12-Mar-15 0:59am View
Thanks for reply.
Santosh K. Tripathi 10-Mar-15 8:10am View
what you have tried?
Santosh K. Tripathi 10-Mar-15 1:34am View
what you tried?
Santosh K. Tripathi 10-Mar-15 1:34am View
what you tried?
Santosh K. Tripathi 10-Mar-15 0:48am View
giving me the code ?
what is this?
Santosh K. Tripathi 10-Mar-15 0:42am View
thanks :)
Santosh K. Tripathi 10-Mar-15 0:37am View
I want to highlight these two words. but could not make it bold in comment area.

I mean these two words are in positive way :) not in negative.
Santosh K. Tripathi 10-Mar-15 0:15am View
Once again +5 from me.

Really, I like your way of answering questions. I learn a lot from your "detailed" and "deep" answers.

Santosh K. Tripathi 9-Mar-15 3:01am View
vijay asked "Written one Example or Approach..."

I think someone should tell him how to start. latest give him some example links.

As per my understating if someone asking for approach, we should give him some hint, at least he can go to start.

by the way, it may be helpful for you

Santosh K. Tripathi 8-Mar-15 23:57pm View
5+ from me :)
Santosh K. Tripathi 5-Mar-15 6:32am View
Read UPDATE part of the article.

As Chris[^] suggested, I would like to add here itself as a part of the Tip/Trick that I would not suggest to use it and mess with browser's history as this is a bad, bad thing.
One should implement it, only if they really need it and are prepared to accept that it is not a good practice.

some time we haven't any good option and we have to do something, to resolve problem.
Santosh K. Tripathi 5-Mar-15 6:26am View
Hi, could you clarify it.
Santosh K. Tripathi 5-Mar-15 6:16am View
what you have tried?
Santosh K. Tripathi 4-Mar-15 23:33pm View
Santosh K. Tripathi 4-Mar-15 23:21pm View
5+ :)
Santosh K. Tripathi 4-Mar-15 1:15am View
why it is down voted, while solution is accepted. unable to understand?
Santosh K. Tripathi 3-Mar-15 23:02pm View
_SA is right.

As per MSDN ( )
1. Write only one statement per line.
2. Write only one declaration per line.

this will easy and save your time during debugging/ Maintenance.
Santosh K. Tripathi 3-Mar-15 3:43am View
What you tried?
Santosh K. Tripathi 2-Mar-15 23:22pm View
This place is for learning something, Not for getting ready made solutions.

Try from your self. if you need any help, then every one is here to help you.
Santosh K. Tripathi 2-Mar-15 23:09pm View
thanks :)
Santosh K. Tripathi 2-Mar-15 22:55pm View
it is same as solution 1.
Santosh K. Tripathi 2-Mar-15 22:41pm View
what is issue in writing SP?
Santosh K. Tripathi 2-Mar-15 22:39pm View
this is also
Santosh K. Tripathi 2-Mar-15 1:30am View
i could not understand, why it is down voted?
Santosh K. Tripathi 1-Mar-15 22:52pm View
Is it web application or desktop application?
Santosh K. Tripathi 26-Feb-15 23:48pm View
5+ from me. :)
Santosh K. Tripathi 26-Feb-15 23:38pm View
give us some clue about column name of both table and some sample data.
Santosh K. Tripathi 26-Feb-15 23:34pm View
Santosh K. Tripathi 26-Feb-15 23:32pm View
don't post as solution. you should post a comment.
Santosh K. Tripathi 26-Feb-15 23:19pm View
Peter Leow's answer is good.
Santosh K. Tripathi 26-Feb-15 1:13am View
where is problem?

Run application in debug mode and get value of 'insertQryPatient' and 'insertQriTreat'.

execute these values (SQL inset command) in you database to know , Where is problem?
Santosh K. Tripathi 23-Feb-15 2:11am View
Santosh K. Tripathi 23-Feb-15 1:02am View
Santosh K. Tripathi 23-Feb-15 0:50am View
good information.
Santosh K. Tripathi 23-Feb-15 0:50am View
Santosh K. Tripathi 22-Feb-15 23:29pm View
Santosh K. Tripathi 22-Feb-15 23:27pm View
Santosh K. Tripathi 22-Feb-15 23:18pm View
Could make it more clear. what is code?
By the way put some condition to break loop.
Santosh K. Tripathi 20-Feb-15 1:23am View
5* from me also :)
Santosh K. Tripathi 20-Feb-15 0:17am View
thanks for this information.
Santosh K. Tripathi 20-Feb-15 0:11am View
Please put some more details about your requirement. your question is not clear.
Santosh K. Tripathi 18-Feb-15 4:03am View
i will keep it in mind next time :)
Santosh K. Tripathi 12-Feb-15 23:27pm View
thanks for response. My solution is showing here two time, really i don't know how it happen.

we can discourse little bit more. i want to put my few points.

1. in my answer i did use 'new Array' keyword because

2. I used '*possible.length' instead of '*36 (no need to calculate array length manually, easy for maintenance if you add/remove few characters in array).
Santosh K. Tripathi 10-Feb-15 5:49am View
Is this answer wrong?
or 'ttds' has accepted any solution and hence question is closed?
or a person can't answer a question if question is old?

I was searching for some this and found this question. I answered it because some time earlier i was facing same issue.
Santosh K. Tripathi 9-Feb-15 22:57pm View
Thanks RyanDev for this information. i never thought this type things can create problem.
Santosh K. Tripathi 5-Feb-15 5:57am View

Could you tell me 'error message' is comes from database or from browser itself.
Santosh K. Tripathi 5-Feb-15 3:52am View
Reason for my vote of 5 \n Nice and useful
Santosh K. Tripathi 5-Feb-15 3:17am View
welcome :)
Santosh K. Tripathi 5-Feb-15 1:46am View
It is not clear. Please use Improve question to make it clear.
Santosh K. Tripathi 5-Feb-15 1:46am View
It is not clear. Please use Improve question to make it clear.
Santosh K. Tripathi 4-Feb-15 23:51pm View

I need to know

1. length of City Field.
2. How are you adding city? Means while inserting new country you are adding multiple city at same time or you want to update city flied by adding one more cityin existing cites.
Santosh K. Tripathi 4-Feb-15 23:05pm View
Yes you right. yesterday i was facing same problem. After debugging i come to know this behavior of JS.
Santosh K. Tripathi 27-Jan-15 2:25am View
so what is issue?
Santosh K. Tripathi 26-Jan-15 23:14pm View
Could you tell, what values are you passing in txtdate1 and txtdate2?
Santosh K. Tripathi 23-Jan-15 6:45am View
as you are saying

datatable.rows.count < 0

it means data table has less than zero row. even if a data table is empty still it's row count is zero (0).

so row count in negative number doesn't makes any seance.

Please explain your question by giving some good example, so we can understand.
Santosh K. Tripathi 22-Jan-15 2:18am View

public DataRow[] Select(
string filterExpression

filterExpression should be string. so "or" is correct instead of ||
Santosh K. Tripathi 15-Jan-15 1:12am View
May i know who and why downvoted this answer.

Plz let me "what is wrong with this answer?".
Santosh K. Tripathi 14-Jan-15 6:55am View
Santosh K. Tripathi 14-Jan-15 1:43am View
its correct use one table and identify user by Unique key.
Santosh K. Tripathi 14-Jan-15 0:22am View
Don't include the () in the call to setInterval. its my experience for timeout or setInterval don't include () with function name. its creates problem.
Santosh K. Tripathi 14-Jan-15 0:13am View
Santosh K. Tripathi 13-Jan-15 23:34pm View
this is the correct, way go with it.
Santosh K. Tripathi 13-Jan-15 22:54pm View
Hi, if u find my answer is useful for you, "accepted" my answer.
Santosh K. Tripathi 12-Jan-15 23:33pm View
Reason for my vote of 2 \n could you tell me what is new in this article.

take a look
Santosh K. Tripathi 20-Aug-14 1:55am View
upload means

1. Make a form there should be file browse option (like, when we upload photo on or attach any file in mail) and a button.
2. by browsing set path and on click of button start read and save data of file.

These may help to you...
Santosh K. Tripathi 19-Aug-14 6:13am View
thanks it works for me also....
Santosh K. Tripathi 4-Aug-14 0:13am View
Santosh K. Tripathi 4-Aug-14 0:12am View
i am unable to understand what do you want to say?
Santosh K. Tripathi 25-Jul-14 1:56am View
Thanks :)
Santosh K. Tripathi 22-Jul-14 1:22am View
Santosh K. Tripathi 14-May-14 6:01am View
Thanks for information.. :)
Santosh K. Tripathi 14-May-14 4:39am View
good answer :) 5
Santosh K. Tripathi 13-May-14 1:38am View
Reason for my vote of 3 \n useful
Santosh K. Tripathi 7-May-14 1:04am View

You have to read it from database and the use like lblUserID.Text = dt.Rows[0]["user_id"]
Santosh K. Tripathi 6-May-14 0:16am View
+5 from me
Santosh K. Tripathi 29-Apr-14 5:38am View
try this one
Santosh K. Tripathi 29-Apr-14 5:34am View
i made some change in it. define two functions convertToDecimal() & convertToString they will return you needed value. you can use this function in you application any where you need a value without error.

SqlCommand cmd=new SqlCommand("spInsertArts",con);
cmd.Parameters.AddWithValue("@Price",convertToDecimal (txtprice.Text));


function 1.

private decimal convertToDecimal(string testValue)
decimal result = decimal.Zero;

if (testValue != null || testValue != "")
decimal number;
if (decimal.TryParse(testValue, out number))
result = Convert.ToDecimal(testValue);
result = Convert.ToDecimal(DBNull.Value);
// Note if you will pass Alphabet or other characters it will return you 0 (Zero).

return result;

function 2.

private string convertToString(string testValue)
string result = string.Empty;

if (testValue != null || testValue != "")
result = Convert.ToString(testValue);
result = Convert.ToString(DBNull.Value);

return result;
Santosh K. Tripathi 29-Apr-14 4:25am View
hi, if it worked for you plz, accept answer and rate it.
Santosh K. Tripathi 28-Feb-14 2:11am View
by mistake.. i unanble to understand voting system on this portal
Santosh K. Tripathi 28-Feb-14 0:10am View
Thanks a lot dear for a quick and correct reply.. by the way it works with crome, firefox, IE9, safari...