//Here the scenario
DataSet dsSoruce = new DataSet();
DataSet ds1 = new DataSet();
DataTable dt1 = new DataTable("SelectedData");
DataRow[] dr1 = null;
string strExpr = string.Empty;
strExpr = "Name Like 'H%' "
// here we are doing copy into local dataset
ds1 = dsSoruce.Copy();
//copy talbe into local table
dt1 = ds1.Tables[0];
// get selected rows
dr1 = dt1.Select(strExpr);
if ((dr1 != null) && (dr1.Length > 0))
{
//clear the main dataset table
dsSoruce.Tables[0].Clear();
//import the row into main dataset
foreach (DataRow dr in dr1)
{
dsSoruce.ImportRow(dr);
}
}
Sunday, November 2, 2008
System.Exception: System.Data.OracleClient requires Oracle client software version 8.1.7 or greater
Solution:
go to :-
C:\Oracle\product\10.1.0\Client_2 folder
follow the below steps:
1) right click on this folder
2) go to properties
3) select "administrator"
4) remove 'Read & Executes' permission
5) again add 'Read & Executes' permission on this folder
there you go...
go to :-
C:\Oracle\product\10.1.0\Client_2 folder
follow the below steps:
1) right click on this folder
2) go to properties
3) select "administrator"
4) remove 'Read & Executes' permission
5) again add 'Read & Executes' permission on this folder
there you go...
.Net- ordered Hashtable
.Net 2.0 introduce "OrderedDictionary" in order to store sorted (key,object) pair value.
Here is the sample code in [C#]
using System.Collections.Specialized;
OrderedDictionary objOrderedDictionary = new OrderedDictionary();
objOrderedDictionary.Add("1", "first value");
objOrderedDictionary.Add("5", "second value");
objOrderedDictionary.Add("8", "third value");
objOrderedDictionary.Add("12", "fourth value");
//set enumerator
IDictionaryEnumerator enumerator;
enumerator = odServiceAmount.GetEnumerator();
while (enumerator.MoveNext())
{
string sKey = enumerator.Key.ToString().Trim();
string sValue = enumerator.Value.ToString().Trim();
}
Here is the sample code in [C#]
using System.Collections.Specialized;
OrderedDictionary objOrderedDictionary = new OrderedDictionary();
objOrderedDictionary.Add("1", "first value");
objOrderedDictionary.Add("5", "second value");
objOrderedDictionary.Add("8", "third value");
objOrderedDictionary.Add("12", "fourth value");
//set enumerator
IDictionaryEnumerator enumerator;
enumerator = odServiceAmount.GetEnumerator();
while (enumerator.MoveNext())
{
string sKey = enumerator.Key.ToString().Trim();
string sValue = enumerator.Value.ToString().Trim();
}
Query to find duplicate record in SQL server table & store into table
1) Simple query to find duplicate records in SQL server
select a,count(1)
from #temp
group by a
having count(1) > 1
order by count(1) desc
2) Dump the duplicate records into SQL table
create table #temp (a varchar(15),b varchar(15),c int)
insert into #temp
select emp_no,emp_name,count(1)
from employee
group by emp_no,emp_name
having count(1) > 1
drop table #temp
select a,count(1)
from #temp
group by a
having count(1) > 1
order by count(1) desc
2) Dump the duplicate records into SQL table
create table #temp (a varchar(15),b varchar(15),c int)
insert into #temp
select emp_no,emp_name,count(1)
from employee
group by emp_no,emp_name
having count(1) > 1
drop table #temp
Saturday, September 13, 2008
Query to remove duplicate record from the table - Oracle
SELECT a.Employee_No,a.Employee_Name
FROM Employee_Contact a
where rowid >
(select min(rowid) from Employee_Contact b
where a.Employee_No = b.Employee_No
)
FROM Employee_Contact a
where rowid >
(select min(rowid) from Employee_Contact b
where a.Employee_No = b.Employee_No
)
How to flush the word & excel file from the web site, using C#
System.IO.FileInfo file;
here sFile = your virtual file path (/myfiles/abc.xls)
file = new System.IO.FileInfo(sFile);
if (file.Exists)
{
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;
filename=" + file.Name);
HttpContext.Current.Response.AddHeader("Content-Length", file.Length.ToString());
HttpContext.Current.Response.ContentType = "application/vnd.ms-excel";
HttpContext.Current.Response.WriteFile(file.FullName);
HttpContext.Current.Response.End();
System.GC.Collect();
}
else
{
HttpContext.Current.Response.Write("This file does not exist.");
}
here sFile = your virtual file path (/myfiles/abc.xls)
file = new System.IO.FileInfo(sFile);
if (file.Exists)
{
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;
filename=" + file.Name);
HttpContext.Current.Response.AddHeader("Content-Length", file.Length.ToString());
HttpContext.Current.Response.ContentType = "application/vnd.ms-excel";
HttpContext.Current.Response.WriteFile(file.FullName);
HttpContext.Current.Response.End();
System.GC.Collect();
}
else
{
HttpContext.Current.Response.Write("This file does not exist.");
}
How to kill/close the EXE's using C#
Below is the code to close word/excel exe uisng C#
Process[] eProcess;
eProcess = System.Diagnostics.Process.GetProcessesByName("EXCEL");
eProcess[0].Kill();
Process[] wProcess;
wProcess = System.Diagnostics.Process.GetProcessesByName("WINWORD");
wProcess[0].Kill();
Process[] eProcess;
eProcess = System.Diagnostics.Process.GetProcessesByName("EXCEL");
eProcess[0].Kill();
Process[] wProcess;
wProcess = System.Diagnostics.Process.GetProcessesByName("WINWORD");
wProcess[0].Kill();
Default redirect to https protocol -- for 403.4 Or 403- IIS setting
Please follow below steps for default redirection.
1) start > run -- type "inetmgr"
2) click ok
3) go to website > default websit
4) right click on default website
5) select properties
6) click on 'custom errors' tab
7) find 403.4 error code
8) give your redirection page path.
like 'c:/inetpub/wwwroot/redirect.htm"
Here is the code for "redirect.htm" page
1) start > run -- type "inetmgr"
2) click ok
3) go to website > default websit
4) right click on default website
5) select properties
6) click on 'custom errors' tab
7) find 403.4 error code
8) give your redirection page path.
like 'c:/inetpub/wwwroot/redirect.htm"
Here is the code for "redirect.htm" page
Labels:
403,
403.4,
http to https,
IIS,
IIS6.0
Default rediret to https protocol -- for 403.4 Or 403
Please follow below steps for default redirection.
1) start > run -- type "inetmgr"
2) click ok
3) goto website > default websit
4) right click on default website
5) select properties
6) click on 'custom errors' tab
7) find 403.4 error code
8) give your redirection page path.
like 'c:/inetpub/wwwroot/redirect.htm"
Here is the code for "redirect.htm" page
1) start > run -- type "inetmgr"
2) click ok
3) goto website > default websit
4) right click on default website
5) select properties
6) click on 'custom errors' tab
7) find 403.4 error code
8) give your redirection page path.
like 'c:/inetpub/wwwroot/redirect.htm"
Here is the code for "redirect.htm" page
How to pass the parameter using Ado.net to SQL & Oracle
1)
To pass parameter in SQL query OR stored procedure
use- NAME = @MYNAME
here- @MYNAME is parameter
2)
To pass parameter in Oracle query OR stored procedure
use: NAME = :MYNAME
here- :MYNAME is parameter
To pass parameter in SQL query OR stored procedure
use- NAME = @MYNAME
here- @MYNAME is parameter
2)
To pass parameter in Oracle query OR stored procedure
use: NAME = :MYNAME
here- :MYNAME is parameter
Sunday, August 17, 2008
How to prevent F5 or page refresh event in web based appliation
http://anujkrathi.blogspot.com/2007/06/how-to-prevent-users-to-press-f5-key.html
http://aspalliance.com/687
http://aspalliance.com/687
Data Access Application Block & Exception Handling Application Block
http://aspnet.4guysfromrolla.com/articles/062503-1.aspx
DAAB:
----
http://msdn2.microsoft.com/en-us/library/ms954827.aspx
Exception Handling Application Block (EHAB)
--------------------------------------------------------
http://msdn2.microsoft.com/en-us/library/ms954830.aspx
----------------------------------------------------
Enterprise Library 3.1 - May 2007
--------------------------------------------------------
https://www.microsoft.com/downloads/thankyou.aspx?familyId=5a14e870-406b-4f2a-b723-97ba84ae80b5&displayLang=en&hash=4trpDN%2bk1m83lSMkDNwbUKt0jafgzIfQLZsbka8pGpaowHu9sRb%2f%2fSl7to1Uji4I4C%2f3uJoiCQLIIEAaTNB8kQ%3d%3d
DAAB:
----
http://msdn2.microsoft.com/en-us/library/ms954827.aspx
Exception Handling Application Block (EHAB)
--------------------------------------------------------
http://msdn2.microsoft.com/en-us/library/ms954830.aspx
----------------------------------------------------
Enterprise Library 3.1 - May 2007
--------------------------------------------------------
https://www.microsoft.com/downloads/thankyou.aspx?familyId=5a14e870-406b-4f2a-b723-97ba84ae80b5&displayLang=en&hash=4trpDN%2bk1m83lSMkDNwbUKt0jafgzIfQLZsbka8pGpaowHu9sRb%2f%2fSl7to1Uji4I4C%2f3uJoiCQLIIEAaTNB8kQ%3d%3d
Selecting an item in a drop down list
ddlyearcount.Items.FindByValue(currentyear.ToString()).Selected = true;
Saturday, August 16, 2008
The request failed with HTTP status 401: Unauthorized." - SQL Reporting Services
Visit below link for more information
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=225392&SiteID=1
Go to IIS
for "Reports" virtual directory, remove anonymous access
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=225392&SiteID=1
Go to IIS
for "Reports" virtual directory, remove anonymous access
This row already belongs to another table
While playing with .net data set & data table, if they are pointing to same memory location will get above error.
for more information, visit below link
http://www.geekzilla.co.uk/View37EB5230-5B79-4D00-800C-52D7A46CFB15.htm
for more information, visit below link
http://www.geekzilla.co.uk/View37EB5230-5B79-4D00-800C-52D7A46CFB15.htm
How to conver database null to zero in Oracle
NVL(field, 0)
for more information visit
http://archives.postgresql.org/pgsql-sql/2002-12/msg00139.php
for more information visit
http://archives.postgresql.org/pgsql-sql/2002-12/msg00139.php
System.Data.OracleClient requires Oracle client software version 8.1.7 or greater.
System.Data.OracleClient requires Oracle client software version 8.1.7 or greater.
Solution:
Solution:
Modified the registry key for that. For registry key information visit below web site
http://msdn2.microsoft.com/en-us/library/aa344212(VS.85).aspxhttp://thedotnet.com/nntp/34104/showpost.aspx
Validation of viewstate MAC failed
Error:1
Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure thatconfiguration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.
Solution:
visit
http://forums.asp.net/p/955145/1173230.aspx#1173230
Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that
Solution:
visit
http://forums.asp.net/p/955145/1173230.aspx#1173230
SQL Server An error has occurred while establishing a connection to the server
SQL server error:26 SQL Server does not allow remote connections
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
Solution:
Go to
start > Programs > SQL server 2005 > Configuration Tools > SQL Server 2005 Surface Area Configuration.
Click on "Surfacr Area Configuration for Services and Connection"
Enable Remote Connection option
there we go
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
Solution:
Go to
start > Programs > SQL server 2005 > Configuration Tools > SQL Server 2005 Surface Area Configuration.
Click on "Surfacr Area Configuration for Services and Connection"
Enable Remote Connection option
there we go
First blog
Hi guys, this is very first time i am writing blogs. I was thinking since long back that to create blogs but today i get some time. I am working as a software professional, day to day life we face some challenging & difficulties while programming, we were try hard to resolve that issues & we are happy.
But i would like to share the solutions, May be it would be helpful to others.
Thanks to visit my blogs I would appreciate your feedback, Please feel free to contact me at prashantbrathod@gmail.com
But i would like to share the solutions, May be it would be helpful to others.
Thanks to visit my blogs I would appreciate your feedback, Please feel free to contact me at prashantbrathod@gmail.com
Subscribe to:
Posts (Atom)