Monday, October 26, 2009

Creating an insertion from a Table with Select

trying to insert to an Opertor TABLE that has values already in with another Type wich I'm setting as constant.

SELECT 'insert into Operator Values('+','+ Name +','+ 2 as TypeID ,Operation as Operation from dbo.Operator

From the Result of the query (grid or text) you can apply the result with in Linqpad or Sql management Studio.


Thursday, October 15, 2009

droping all connections with sql server

you can kill all the processes using a database:

USE master
go

DECLARE @dbname sysname

SET @dbname = 'name of database you want to drop connections from'

DECLARE @spid int
SELECT @spid = min(spid) from master.dbo.sysprocesses where dbid = db_id(@dbname)
WHILE @spid IS NOT NULL
BEGIN
EXECUTE ('KILL ' + @spid)
SELECT @spid = min(spid) from master.dbo.sysprocesses where dbid = db_id(@dbname) AND spid > @spid
END




If you want to drop all the connections to a database immediately

USE master
GO

ALTER DATABASE database name
SET OFFLINE WITH ROLLBACK IMMEDIATE
ALTER DATABASE database name
SET ONLINE




or if you are in a hurry there is an option that says"drop all database connections" as a checkbox in the window displayed for the detach task and you just check it and does close the connections.

Tuesday, October 13, 2009

NO JOINS IN ORACLE

This is what it says in Oracle site. So that's the end point of it. Here are the examples


Using Join Queries: Examples The following examples show various ways of joining tables in a query. In the first example, an equijoin returns the name and job of each employee and the number and name of the department in which the employee works:

SELECT last_name, job_id, departments.department_id, department_name
FROM employees, departments
WHERE employees.department_id = departments.department_id
ORDER BY last_name;

Using Self Joins: Example The following query uses a self join to return the name of each employee along with the name of the employee's manager. A WHERE clause is added to shorten the output.

SELECT e1.last_name||' works for '||e2.last_name
"Employees and Their Managers"
FROM employees e1, employees e2
WHERE e1.manager_id = e2.employee_id
AND e1.last_name LIKE 'R%';


for more info go to : http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_10002.htm#i2066611

Examples taked from the site.

System Provider

If you are using asp.net 1.1 then go to your machine.config file and in process model section try to chnage user name as "system";

if you are in 2.0 version do the same thing some times you might not find the process model section at all then try add the same section it self.

you can find out the machine.config file in the following location:for 2.0 version i think u are using 2.0

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG


System. Debug




Oracle 10g with C# & asp.net

Now I'm trying to use Entity Framework to connect to an Oracle database with C#. Will see how it goes with this ad and free spacing.

Tools to be used for the test.

- Oracle 10g Express.

- Visual Studio.Net

Thursday, October 8, 2009

Response to Grid backcolor in Row With Ajax

Issue: want to differentiate from one row to another with slight color.

on a different way:









protected void RadGrid1_PreRender(object sender, EventArgs e)
{
foreach (GridDataItem dataItem in RadGrid1.MasterTableView.Items)
{
if (dataItem.Expanded)
{
GridNestedViewItem nestedItem = dataItem.ChildItem;
Panel panel = (Panel)nestedItem.FindControl("PanelID");
if (dataItem.ItemType == GridItemType.AlternatingItem)
{
panel.BackColor = System.Drawing.Color.Gray;
}
if (dataItem.ItemType == GridItemType.Item)
{
panel.BackColor = System.Drawing.Color.White;
}
}
}












on the server side:

protected void Page_Load(object sender, EventArgs e)
{
if(!IsPostBack)
{
var radAjaxManager = RadAjaxManager.GetCurrent(Page);
radAjaxManager.ClientEvents.OnResponseEnd = "gridRowColor";
}

Friday, October 2, 2009

Anthroposophy

Anthroposophy, a spiritual philosophy based on the teachings of Rudolf Steiner, postulates the existence of an objective, intellectually comprehensible spiritual world accessible to direct experience through inner development—more specifically through cultivating conscientiously a form of thinking independent of sensory experience. In its investigations of the spiritual world, anthroposophy aims to attain the precision and clarity of natural science's investigations of the physical world. Whether this is a sufficient basis for anthroposophy to be considered a spiritual science has been a matter of controversy

Taked from wikipedia.

Thursday, October 1, 2009

Linq with Outer Join, Ternary and orderby with linq

var query = from lfp in db.LogFundingPrograms
join rc in db.RefCycles on lfp.CycleId equals rc.CycleId
into JoinedRc
from rc in JoinedRc.DefaultIfEmpty()
join rf in db.RefFrequencies on lfp.Frequency equals rf.FrequencyId
orderby lfp.LogFundingId descending
select new
{
lfp.LogFundingId,
lfp.LogActionId,
lfp.FundingId,
lfp.FundingCode,
lfp.InstrumentCode,
LogActionDescription = lfp.RefLogAction.Description,
lfp.ApplicableDate,
lfp.Description,
rf.Frequency,
lfp.RollOverDay,
CycleDesc = lfp.CycleId != null ? rc.CycleDesc : "",
lfp.CCY,
lfp.CycleId,
lfp.IsConfirmed,
lfp.LastUser,
lfp.LastModified
};

as you can see the CycleDesc comes with a empty string if the CycleId doesn't bring a value since can be null.