Thursday, August 13, 2009

Solution to this error:Maximum stored procedure, function, trigger, or view nesting level exceeded (limit 32)

Just turn off recursives triggers,views ,functions and store pro wich
cause the problem.
For trigger for example Go to SSMS,open the table in question,open trigger folder
and right click the trigger that cause the problem and choose disable.
You should be good to go.


Talley Ouro
Developer

Saturday, August 8, 2009

Useful JavaScripts for DataGrid control






This codes will help you with your datagrid activities.
You have to add a CheckBox to datagrid.

HTML Code


this html tag adds a checkbox to header 1-add asp:TemplateColumn tag
2-add HeaderTemplate tab
3-add input tag with id=checkAll,type=checbox,onclick=DGSelectOrUnselectAll('DataGrid1',this,'chkDel')

this html tag adds checkbox to datagrid 1-add ItemTemplate tag
2-add asp checkbox control within ItemTemplate tag with id=chkDel,RunAt=server


JavaScript codes:Add these js code in
section of HTML

this is to select or unselect the datagrid check boxes

function DGSelectOrUnselectAll(grdid,obj,objlist){
//this function decides whether to check or uncheck all
if(obj.checked)
DGSelectAll(grdid,objlist)
else
DGUnselectAll(grdid,objlist)
}
//----------

function DGSelectAll(grdid,objid){
//.this function is to check all the items
var chkbox;
var i=2;

chkbox=document.getElementById(grdid +
'__ctl' + i + '_' + objid);

while(chkbox!=null){
chkbox.checked=true;
i=i+1;
chkbox=document.getElementById(grdid +
'__ctl' + i + '_' + objid);
}

}//--------------

function DGUnselectAll(grdid,objid){
//.this function is to uncheckcheck all the items
var chkbox;
var i=2;

chkbox=document.getElementById(grdid +
'__ctl' + i + '_' + objid);

while(chkbox!=null){
chkbox.checked=false;
i=i+1;
chkbox=document.getElementById(grdid +
'__ctl' + i + '_' + objid);
}
}

If you have question please email me at johnstalley@live.com
My name is Talley Ouro,Developer in Raleigh,NC

Thursday, August 6, 2009

How to hack "Failed to query a list of database names from the SQL Server"

Sometimes ASP.NET Configuration Tool(ASP.NET) is a pain in the ass when trying to add aspnet.db for role management.

By default on Vista the current user on the machine is not a member of SysAdmin on SQL Server 2005/2008.

So here is the trick.

1-Open Sql Server Surface Area Configuration tool from C:\Program Files\Microsoft SQL Server 2005/2008.






2-When the screen pops up click on Add New Administrator.





-on top right make sure that User to provision=Username of the pc
-on your left (Available Privileges) select Member of SQL Server SysAdmin and click on the right arrow (>)
-click ok and you should be ready to go.

My name is Talley Ouro,Developer in Raleigh,NC
Blog: http://talleyblogs.blogspot.com/
Email:johnstalley@live.com

Sunday, August 2, 2009

Code to add JavaScript confirmation dialog to a button in a datagrid




Here is the code.It is free like "free beer".If you have question send me email at johnstalley@live.com.Remember datagrid index it 0 based.
NB You could add another parameter to the function that will execute when click=ok



public static void AddConfirm(DataGrid theGrid, int columnNumber, string question)
{
//for each row in the DataGrid
foreach(DataGridItem item in theGrid.Items)
{
//for each webcontrol in the column
foreach(WebControl control in item.Cells[columnNumber].Controls)
//if it is a LinkButton or Button
{
if(control is LinkButton || control is Button)
//add the attribute
control.Attributes.Add("OnClick", " javascript:return confirm('" + question + "');");
}
}
}

How to color a row of DataGrid in ASP.NET 2.0/3.5



1-Here is the code in VB.NET 2005/2008
The name i gave empGrid to the datagrid.To do this go the property of datagrid and
click on the events section and double click on ItemDataBound event and add the code.

Protected Sub empGrid_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles empGrid.ItemDataBound

If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then

Dim drv As DataRowView = CType(e.Item.DataItem, DataRowView)
Dim Status As String = Convert.ToString(drv.Row.Item("Status"))

If Status = "Active" Then
e.Item.Cells(4).BackColor = Drawing.Color.Green

ElseIf Status = "Inactive" Then
e.Item.Cells(4).BackColor = Drawing.Color.Red

End If
End If
End Sub
1-Here is the code in C# 2005/2008
The name i gave empGrid to the datagrid.To do this go the property of datagrid and
click on the events section and double click on ItemDataBound event and add the code.

private void empGrid_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item ||
e.Item.ItemType == ListItemType.AlternatingItem)
{
DataRowView Drv = (DataRowView)e.Item.DataItem;
// Get fourth column value.The coloumn needed
String Status = Convert.ToString(rv.Row.ItemArray[4]);
if (Status =="Active")
{
e.Item.Cells[4].BackColor = Color.Green;
}
//Just add the remaining steps
}
}

This code is free like "Free Coffee"

Talley Ouro

Thursday, July 16, 2009

Try free Live HTML and Javascript

There is a new great tool on Mozilla.org website.
It name is Bespin.
With Bespin you can test your HTML and js codes online.

Here is the link to Bespin:
https://bespin.mozilla.com

You need to open an account with Mozilla project in order
to use Bespin

Enjoy it!

Talley

Sunday, February 1, 2009

free PHP training in 1 month(Part III)




Hi all,


Sorry i was busy.Now let start our first hello world program from PHP.

Steps:

1- Open your NetBeans IDE from Start Menu.

2-Go to File/New Project/Select PHP from Category/PHP application/Next/Give HelloWorld to application name/Click Finish.

After you finish you will see a page with a bloc of code for index.php.I will will explain to you more about this file later.



// put your code here
?>


Note1:
Every php application starts with .
The php code goes within

Note2:

You declare php variable with a dollar sign $ follow by the name of the variable.
For more info about definition go to php.net/documentation.

Let declare a variable named i and assign it 12;

$i='Hello World';

Note 3:
Single quote is best way to handle string.Do not use "" for strings.Any variable
within "" will be Executed.

Note 4:
Php comment is c# style // or /* */
Let print it to the browser.The best browser for php is FireFox.
Right click on the projoect HelloWorld/Properties/Debug/Deselect Debug Server with php/Seelect Debug client with Javascript/Choose FireFox and click OK.

Now let print $i to the browser.
add code like this:


$i='Hello World;
//to print hello world we use echo keyword or print

echo $i;


?>

Note 5:Every variable declaration end with ; like c#

Run the project :Right click on index.php/Run.

You will see Firefox showing Hello World.

Note6:
PHP is a loosy type.It mean you don`t have to define a variable type to use it.
Let me be clair.In C# if i want to declare an integer variable named i this is how i
will do it:

int i=12;
In php $i=12;so php is less trouble than c#,vb......

See you Next time.Remember to go to documentation section of php.net and copy
php keyword to a file named keyphp.txt on your desktop.

Talley John
Software Developer

About Me

My photo
Raleigh, NC, United States
I am a software developer based in Raleigh,NC,USA.I design softwares and systems ;i also do consulting for companies worldwide.I program with these languages:VB.NET 2003/2005/2008;C#;Java(fun),SQL(200,2005,2008);ASP.NET 2.0/3.5;ASP.NET AJAX;ASP.NET MVC;JavaScript;JQuery;Windows Workflow Foundation;Web Services.I have 4 years + in programming.