Wednesday, December 29, 2010
YouTube EZ Upload .NET Component
This sample source code package will be sent to your on your purchased email address.
Supported Platform: Vista 32 bits, Windows XP, Windows Server 2003/2008, .NET Framework 2.0,3.0,3.5 and 4.0
Click Here to Purchase & Download.
Click Here for: How to add NetFix EZ YouTube Upload into your web application.
Thursday, December 23, 2010
How to enable SQL Dependency on SQL 2008 Server for .NET Website Caching
How to enable SQL Dependency on SQL 2008 Server for .NET Website Caching
I am unable to put the code on blogget.com don't know why.
So please visit: my blog on word press for complete blog post.
In your web.config make sure have tag declared as shown below:
Then run these commands using your command prompt:
To Enable Sql Dependency:
aspnet_regsql.exe -S localhost -E -d pubs -t authors -et
or if this doesn't work then try this:
aspnet_regsql.exe -S localhost -U your_db_username -P your_db_password -d pubs -t authors -et
or if you want to allow to whole database then try this:
aspnet_regsql.exe -S localhost -U your_db_username -P your_db_password -d pubs -ed
To Disable Sql Dependency:
aspnet_regsql.exe -S localhost -E -d pubs -t authors -dt
or if this doesn't work then try this:
aspnet_regsql.exe -S localhost -U your_db_username -P your_db_password -d pubs -t authors -dt
or if you want to allow to whole database then try this:
aspnet_regsql.exe -S localhost -U your_db_username -P your_db_password -d pubs -dt
Than just add the output cache in your asp.net page or contols (.aspx or .asmx) pages.
<outputCache enableOutputCache ="true" duration = "1000" varByParam="None">
Hope this helps!
Saturday, November 13, 2010
Friday, September 17, 2010
Checked one checkbox at a time in vb.net
1. Add JQuery library into your page under header section.
2. Add checkboxes in body of your page
3. Add script at the end of the page after the body tag
script type ="text/javascript" language ="javascript"
(document).ready(function cbox1() {
//var var_name = $('#CheckBox1').attr('checked');
//var var_name = $('#CheckBox2').attr('unchecked');
$('#CheckBox1').attr('checked', true);
$('#CheckBox2').attr('checked', false);
});
$(document).ready(function cbox2() {
//var var_name = $('#CheckBox1').attr('unchecked');
//var var_name = $('#CheckBox3').attr('checked');
$('#CheckBox1').attr('checked', false);
$('#CheckBox2').attr('checked', true);
});
That's it!
Wednesday, July 7, 2010
Wednesday, June 23, 2010
Oracle Tip: Close your Ref Cursor in PL/SQL
There is a way in Oracle that you can close your Ref Cursor in PL/SQL store procedure and still able to retain the value into .NET application. This way you don’t leave unclosed cursor on server side.
------------------------------
Sample Code -- Start
------------------------------
PROCEDURE test(crs_out_cursor out sys_refcursor) AS
crs_error_local sys_refcursor;
mydata sys_refcursor;
rr emp%rowtype;
BEGIN
open crs_error_local for
select * from emp_table;
crs_out_cursor := crs_error_local;
loop
fetch mydata into rr;
exit when mydata%notfound;
end loop;
close crs_error_local;
crs_out_cursor := mydata;
----------------------------------------------------------------------------
--EXCEPITION HANDLER
----------------------------------------------------------------------------
EXCEPTION
when others
then
END test;
-----------------------------
Sample Code -- End
-----------------------------
Enjoy the tip!
Monday, June 21, 2010
Creating XMLHTTPRequestObject - For all Browsers
funciton getXMLHTTPRequest(){
var request = false;
if (window.XMLHTTPRequest){
request = new XMLHTTPRequest();
}else {
if(window.ActiveXObject){
try{
request = new ActiveXObject("Msml2.XMLHTTP");
} catch(err1){
try{
request = [ic:ccc]new ActiveXObject("Microsoft.XMLHTTP");
}catch(err2){
request = false;
}
}
}
}
return request;
Thursday, June 10, 2010
Just link my blog with Amazon :)
Hello Everyone...
Please don't forget to visit Amazon links on my blog. Thank You for visiting my blog. I will be posting more useful information.
Bye!
Wednesday, June 2, 2010
How to write oracle update query without using sub queries
set (setvaluefield1,setvaluefield2,setvaluefield3) =
(select some_otherfield_from_t2, some2_otherfield_from_t2, '201004' from table2
where exists (select t2.pk_field1,t2.field2,t2.field3
from table1 t1,
table2 t2,
table3 t3
where t3.pk_field1 = t1.pk_field1
and t1.pk_field1 = t2.pk_field1
and t3.field2 = t1.field2
and t1.field2 = t2.field2
and (t3.start_date <= '200808' or t3.t1_init_date = '200808') and (t3.end_pricing_date > '200808'
and t3.t1_end_date >= '200808')
and t1.field3 = t2.field3
and t1.field3 not in ('00',' ')
and t1.field4 = '200808'
and t2.field4 = '200808'
and t2.field5 = 'Y'));
Monday, May 24, 2010
Simple Insert in Oracle with Case Statement
Below is a sample code for insert statement here I have used "case statement" in select and "not exists" in where clause..
insert into table1 t1 (field1,field2)
(select field1, case when field2 = ' ' then field2
else to_char(to_number(field2)
end
from table2 t2
where t2.field1 = t1. field1
and not exists (select 1
from table3 t3
where t3.field1 = t2.field1));
please don't forget to visit: http://www.lendmyspace.com
Friday, May 14, 2010
Select in Oracle vs Select in Sybase
In Oracle I came across situation where I have a select statement in SP which executes fine when data IS Found. But crash when there is data is NOT Found. So if you have any place where you need to continue with the sp even when data is not found then do the exception block in your code when you unit test.
If you don’t do this your sp will crash and it will go to the end of your exception handler block.
Example:
begin
select myfield1 into v_myfield1
from mytable1
where myfield1= value1;
exception
when no_data_found then
v_myfield1:=NULL;
end;
I think in Sybase the select query will works fine if data is not found. But in oracle world you do need to take care of it.
Hope this helps!
Wednesday, May 12, 2010
SQL/PL Update Statement and Sub Update Statement Findings
Friday, March 26, 2010
How to prevent SQL Injection
How to prevent SQL Injection
Examples that will return if you have used simple query string in your application.
Fetch All:
x’ or ‘t’=’t’ --
Discover all tables
‘union select 0, id, name,0,0,0,0,0,0,0 from sysobjects where xtype = ‘U’ --
Discover all columns
‘union select 0, name,1,0,0,0,0,0,0,0 from syscolumns --
Steal DB Users
‘union select 0, uid, name, password, roles, 0,0,0,0,0,0,0 from sysusers --
Change Cell Phone Number
888-88-8888’; update authors set phone = ‘111-11-1111’ --
Drop table
888-88-8888’; drop table discounts --
Disconnect or brind SQL Server Down
888-88-8888; exec master..xp.cmdshell ‘ipconfig /release’
(note: this depends on what version of sql database you have. Will only works if allowed by the sql database on your machine)
Or to stop sql
888-88-8888; exec master..xp_cmdshell .net stop sqlserver’
To Pervent all these do one of 3 things:
1- Use Parameterized Queries by using SqlParameter calling addSqlParameter
2- Use Stored Procedure
3- Use LINQ
Thursday, February 4, 2010
How to use cursor in oracle stored procedure
create or replace PROCEDURE sp_myprocedure(p_1 IN t1.c1%Type,
p_2 IN t1.c2%Type,
p_3 IN t3.c3%Type)
AS
BEGIN
DECLARE
v_myvariable char(7);
CURSOR crs_my_cursor IS
select * from mytable1;
BEGIN
IF (NOT crs_my_cursor%ISOPEN) THEN -- IF 1
OPEN crs_my_cursor;
END IF;
FETCH crs_my_cursor into v_my_variable;
WHILE (crs_my_cursor%FOUND) LOOP
BEGIN -- begin 2
null;
----START WORKING YOUR CODE HERE..
END;
FETCH crs_my_cursor into v_my_variable;
END LOOP;
CLOSE crs_my_cursor;
EXCEPTION
when others then
rollback;
END;
END sp_myprocedure;
Tuesday, February 2, 2010
How to add jQuery Intellisense in VS 2008
create filder Scripts in your project download both files from jquery.com
add this in your masterpage head section:
<script src="/Script/jquery-1.3.2.js" type="text/javascript"></script>
<script src="Script/jquery-1.3.2-vsdoc.js" type="text/javascript"></script>
<script language ="javascript" type="text/javascript">
$.getJSON(…this should work now..
</script>
Note that i have /Script/jquery-1.3.2.js in the first one and
second vsdoc.js has only Script/jquery-1.3.2-vsdoc.js
Note: don’t forget to add ///
in your /Script/jquery-1.3.2.js
Hope this helps!
Saturday, January 30, 2010
CSS Quick Tip – If something doesn’t look same in IE and Firefox then try this
Type in your CSS where you have that div or css style just type this:
clear: both;
and refresh your page. It should fix your overlap and in consistency in your css look.
Tuesday, January 19, 2010
Add new value in .net dropdownlist control using jQuery
Here is your jQuery code:
// first lets un-select any items that have been selected
$("select.ddlMyDropDown option:selected").removeAttr("selected");
var addvalue = ‘MyNewValue’;
$("select.ddlMyDropDown").prepend('<option selected="selected" value="' + addvalue + '">' + addvalue + '</option>');
Here is your html code:
<asp:DropDownList runat="server" ID="ddlMyDropDown" CssClass="ddlMyDropDown" ></asp:DropDownList>
<br />
<input type="text" id="addToDropDown" class="addToDropDown" visible ="false" size="1" />
Nice!
Tuesday, January 5, 2010
How to remove Team Foundation Server old source control setting from your solution
I had to change my team foundation server and the new one had different name and url.
All of my old project was not able to load back into my new TFS. So I come across this setting in :
C:\Users\loggedinusername\AppData\Local\Microsoft\Team Foundation\2.0\Cache .. make sure that loggedinusername is your user name..
look for VersionControl.config file
open in Visual Studio and make your change here under : <VersionControlServer>
-Adnan