|
try
{
cmd.ExecuteNonQuery();
}
catch(Exception ex)
{
FileStream fs;
StreamWriter sw;
fs = new FileStream("practice.txt", FileMode.Open );
sw = new StreamWriter(fs);
// write a line to the file
//In this line you concatenate the data
string newLine = "Not so different from you and me";
sw.WriteLine(newLine);
// close the streams
sw.Close();
fs.Close();
}
-----> i dont want to store a single line in the practice.txt. i need to store the record values which is failed (i.e.. 100,200) as mentioned in my example.......
How to achieve it?
thanks in advance
|
|
|
|
|
Whether you are entering the values in the textboxes(Roll No) for updating the records.
|
|
|
|
|
no senthil, i m taking those roll numbers from an excel file and processing.... i will pass the roll number one by one. when it failed, i want to store it........
how to achieve it?
|
|
|
|
|
How will you take from excel file can you send me the code?
|
|
|
|
|
hai,
here i am updating 100 records at the same time.
when the update fails, the record is to store in a log file (.txt).
how to implement.?
FOR EXAMPLE.............
try
{
for (i=1;i=5;i++)
{
int a=i;
sqlinsert="update tbl_name set loop_no=a where rollnumber=a";
cmd = new SqlCommand(sqlinsert, conn);
}
}
catch(SqlException ae)
{
strreturn += "<br>Message: " + ae.Message.ToString();
}
How to capture the failure records for the above UPDATE statement?
HELP ME!
i m using ASP.NET with C# (.net 2005, 2.0 framework)
|
|
|
|
|
Hi,
You can use this logic. I hope that this may help you
int b = 0;
string ew;
for (int i = 0; i <= 5; i++)
{
try
{
if(b==i)
ew=Session["Good"].ToString();
Response.Write("pass" + i);
}
catch
{
Response.Write("Failed" + i);
}
}
Cheers..!
Vijay s
|
|
|
|
|
for (i=1;i=5;i++)
{
int a=i;
sqlinsert="update tbl_name set loop_no=a where rollnumber=a";
cmd = new SqlCommand(sqlinsert, conn);
try
{
cmd.ExecuteNonQuery();
}
catch(Exception ex)
{
FileStream fs;
StreamWriter sw;
fs=new Filestream("logfile.txt",FileMode.open);
sw=new StreamWriter(fs);
string newline="Roll No:"+a+"was not updated";
sw.close();
fs.close();
}
}
I think you understand, if you have any doubt ask me.
|
|
|
|
|
once if its go for "CATCH" block, how it can proceed others?
i.e, if record 2 fails, will it proceed other records and complete the whole FOR loop????
i tried.. but getting error...
how to achieve it?
thanks in advance and understanding....
|
|
|
|
|
In my existing project I'm getting this pop up message...
This page contains both secure and nonsecure items. Do you want to display the nonsecure items asp .net c#
But its happening few pages only....whats the exact issue...can somebody tell me...is there any coding (asp .net c#) thru this I can solve it.....
Internet - tool - options----this method doesnt required....
Thnx in advance.
|
|
|
|
|
Mostly it has to do with links in a page. Your page is run in https on the webserver but your link says http. Or you load images in your page with an absolute http path in stead of a relative ~\... path.
|
|
|
|
|
Hi digi..
all images path is such as ../image/........so which one will be better....\
~/image..... or ../image/....
please suggest me asap...
thnx
|
|
|
|
|
/image I think would be better
|
|
|
|
|
thnx..
i have used ../ lets c output....just updating webserver..
|
|
|
|
|
I used ../image path for the images....didnt work....
any other suggestion plz.
thnx.
raj.
|
|
|
|
|
read http://www.4guysfromrolla.com/webtech/121799-1.shtmlthis article about Server.MapPath() functionality
|
|
|
|
|
dynamic raj wrote: any other suggestion plz.
This message is a generic message that means exactly what it says - you are on a secure page (https) but some element of the page is nonsecure (http). This can be anything that is loaded into the page, such as an image (as already suggested), a css file, a script include, an applet etc.
If you are having trouble tracking down the offender, try something like fiddler[^] and watch for any http requests when hitting your https page.
|
|
|
|
|
Hi J4..
just I installed fiddler...
could you explain little bit more...how to track the exact items...
thnx
|
|
|
|
|
erm... it's pretty self-explanatory. Whhen you make a request to a page fiddler shows each http request that your browser is issuing. when you hit the https page look for any requests that says http. Thats you're culprit for the "this page contains both secure and nonsecure ....." message.
|
|
|
|
|
please give me simple code to clear gridview
|
|
|
|
|
gridview.DataSource = null;
|
|
|
|
|
no its not like that, i want to clear the data in gridview then fill some other data in same gridview.
|
|
|
|
|
sounds like you have a refresh problem.
Is your gridview in an updatePanel?
Is the gridview DataBound after set to null ?
gridview.DataSource = null;
gridview.DataBind();
|
|
|
|
|
Hi RajKumar,
adap.Fill(ds,"table1");
ds.Clear();Clear the dataset and
Then fill another data and bind to the gridview
|
|
|
|
|
hi
i am not using any adapetr or dataset . i am using data table.
|
|
|
|
|
Hi RajKumar,
ok then will have a option dt.Clear();
|
|
|
|