vuyiswamb 17 Posting Whiz

Now this means that the problem is here

CommerceLibAccess.GetShippingCost(shippingId);

Show me the code for

GetShippingCost();
vuyiswamb 17 Posting Whiz

ok let us solve the problen first here

decimal amount = ShoppingCartAccess.GetTotalAmount() + shippingCost;

Debug it tell me the return value of this

ShoppingCartAccess.GetTotalAmount()

, you can move your mouse over while debuging it and tell me which one is carrying the incorrect values between shippingCost and ShoppingCartAccess.GetTotalAmount()

vuyiswamb 17 Posting Whiz

When you debug this , does this give you the correct answer you want

decimal amount = ShoppingCartAccess.GetTotalAmount() + shippingCost;

what i mean does the shippingCost variable carry the correct answer ?

Second Question

In the method PopulateControls() does amount bring the correct answer ?

If yes give me an example of a value and show me the wrong display that you see and tell me show me what it supposed to display.

Kind Regards

Vuyiswa Maseko

vuyiswamb 17 Posting Whiz

you have a long code here . Can you point the line that you are having a problem with ?

vuyiswamb 17 Posting Whiz
vuyiswamb 17 Posting Whiz

Thank you this is Perfect :)

vuyiswamb 17 Posting Whiz
vuyiswamb 17 Posting Whiz

is this a Websetup or a Windows Setup ?

vuyiswamb 17 Posting Whiz

It is Simple. Add the grid and the Button inside an Update Panel and every time you click the Button you will not loose the values of the controls that you created dynamically.


kind Regards

Vuyiswa Maseko

vuyiswamb 17 Posting Whiz

Good Day All

I have an Sp and UDF. the UDF cant take #tables. so i want to incorporate the functionality that is being provided by the udf and make it part of the code. the first part of my statement creates a solid table that is being used in the UDF

truncate table temp
INSERT INTO temp 
SELECT MTN.ID,S.DESCR,ISNULL(MTN.CYCLETEMPLATE,C.CYCLES) AS CYCLETEMPLATE,MTN.ACTV AS [ACTV]
FROM TBL_STAFF S
INNER JOIN MTM_ACTV_STAFF MTN ON
S.ID = MTN.STAFF
LEFT OUTER JOIN MTM_ACTV_STAFF_CYCLE C
ON C.IDL = MTN.ID
END 
ELSE
BEGIN 
SELECT MTN.ID,S.DESCR,ISNULL(MTN.CYCLETEMPLATE,C.CYCLES) AS CYCLETEMPLATE,MTN.ACTV AS [ACTV]
into temp
FROM TBL_STAFF S
INNER JOIN MTM_ACTV_STAFF MTN ON
S.ID = MTN.STAFF
LEFT OUTER JOIN MTM_ACTV_STAFF_CYCLE C
ON C.IDL = MTN.ID
END

and later in my Sp i have this line of statement

SELECT DESCR, dbo.GetSortedString(Cast(NULL AS varchar(8000))) AS CycleIdList,ACTV
INTO #TempSummary
FROM temp (NOLOCK)
GROUP BY DESCR,ACTV
ORDER BY DESCR,ACTV

which has no problem and later i want to update the Filed in the #TempSummary table like this

UPDATE #TempSummary
SET CycleIdList = dbo.Concat(#TempSummary.Descr,#TempSummary.actv)

now the problem is here, the Concat is the UDF. defined like this

create FUNCTION [dbo].[Concat] (@Name varchar(50),@Actv int)
RETURNS varchar(max)
WITH EXECUTE AS CALLER
AS
BEGIN
Declare @s varchar(max)
SET @s = ''

SELECT @s = @s + IsNull(',' + Cast(Cycletemplate AS varchar), '')
FROM temp (NOLOCK)
WHERE temp.Descr = @Name And temp.Actv = @Actv
GROUP BY Cycletemplate
ORDER BY Cycletemplate
IF (@S IS NOT NULL) AND (@S <> '') SET @S = SubString(@s, 2, …
vuyiswamb 17 Posting Whiz

Good Day All.

Am binding the treeview from a Database and it gets populated and am sorting it after this way

SortTree(CurriculumTreeView);
private void SortTree(TreeView tv)
    {
        if (tv.Nodes != null)
        {
            for (int i = 0; i < tv.Nodes.Count; i++)
            {
                TreeNode node = tv.Nodes[i];
                SortNode(node);
            }
        }
    }
private void SortNode(TreeNode node)
    {
        if (node.ChildNodes != null && node.ChildNodes.Count > 1)
        {
            for (int i = 0; i < node.ChildNodes.Count; i++)
            {
                TreeNode childNode = node.ChildNodes[i];
                SortNode(childNode);
                SortNodes(node.ChildNodes);
            }
        }
    }
private void SortNodes(TreeNodeCollection nodes)
    {
        if (nodes == null || nodes.Count < 2)
        {
            return;
        }
        for (int i = 0; i < nodes.Count - 1; i++)
        {
            for (int j = 0; j < nodes.Count - 1; j++)
            {
                TreeNode node = nodes[j];
                TreeNode nextNode = nodes[j + 1];
                if (node.Text.CompareTo(nextNode.Text) > 0)
                {
                    TreeNode tempNode = new TreeNode();
                    tempNode = nextNode;
                    nodes.Remove(nextNode);
                    nodes.AddAt(i, tempNode);
                }
            }
        }
    }

when i don't sort, everything is faster, but now with this sorting its very slow and end up timing out.

Thanks

vuyiswamb 17 Posting Whiz

how to fill the gridview columns with multiple queries result?
i mean first column will display the result from first query which returns
only 1 column....
2nd query result will b displayed in second column of same gridview n so on...

Can you please create a Separate thread for this Question.

vuyiswamb 17 Posting Whiz

Now when you were still in your Development machine you took your mdb file and place it in your : drive , now when you move it to your paid domain , there will be no d: drive, Just create a folder in your app and name it "DB" and paste your DB inside there and when you access it in your connection string use

~/DB/myDb.mdb

and you can see how i did it here

http://www.codeproject.com/KB/tips/StoringConstring.aspx

vuyiswamb 17 Posting Whiz

Good Day sknake

Thanks for Pointing that out

IF OBJECT_ID('tempdb..#Temp', 'U') IS NOT NULL DROP TABLE #Temp

Before i used a Solid table , but now it becomes a Problem u in a multi user enviroment because some other users will receive the "temp table does not exist" or "temp table already exist" with #temp table it was going to be easy. but due to the fact that UDF does not like the #temp. Your Solution that you suggested will you please elaborate more deeply on it.

Thanks for you reply.

vuyiswamb 17 Posting Whiz

Good Day All

i have the Following sp

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER PROCEDURE [dbo].[sp_Timetable_View] @selectionType varchar(30),		-- either Venues, Staff, Subjects, Curricula etc...
@selectedItems ntext, @selectedTerms ntext

AS

/*This Part of the code was Representing the Sp Get_Staff_Cycles_For_TimeTable
 due to temp table scope , i had to put the code here so that the temp tables will be available 

/*This code of the code will Add the Cycles to be Displayed ina string 
*/
 */
 IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[tempdb].[dbo].[#temp]'))
drop table [#temp]
--Creation of Temp1
SELECT MTN.ID,S.DESCR,ISNULL(MTN.CYCLETEMPLATE,C.CYCLES) AS CYCLETEMPLATE,MTN.ACTV AS [ACTV]
into #temp
FROM TBL_STAFF S
INNER JOIN MTM_ACTV_STAFF MTN ON
S.ID = MTN.STAFF
LEFT OUTER JOIN MTM_ACTV_STAFF_CYCLE C
ON C.IDL = MTN.ID


--STEP 3 HERE WE ARE CREATING A TEMP TABLE 
--CHECK IF THE TABLE EXISTS FIRST IF IT DOES DROP IT 
--HERE WE ARE CREATING A FIELD CYCLEIDlIST THAT IS EMPTY THAT WILL BE POPULATED LATER
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[tempdb].[dbo].[#TempSummary]'))
drop table [#TempSummary]


SELECT DESCR, dbo.GetSortedString(Cast(NULL AS varchar(8000))) AS CycleIdList,ACTV
INTO #TempSummary
FROM #temp (NOLOCK)
GROUP BY DESCR,ACTV
ORDER BY DESCR,ACTV

--CHECK THE TABLE CONTENTETS
--SELECT * FROM TempSummary
--WE ONLY SAW NAMES THAT ARE NOT DUPLICATED AND NULLS IN THE OTHER FIELD

--HERE WE UPDATE THE TEMPSUMMARY TABLE AND DO SOME CONCATINATING AND THIS IS VERY FAST,
--STEP 4
UPDATE #TempSummary
[B] SET CycleIdList = dbo.Concat(#TempSummary.Descr,actv)[/B]
--SELECT * FROM TempSummary
--LETS CHECK THE TEMP SUMMARY TABLE
--select  * …
vuyiswamb 17 Posting Whiz

I am developing an application right now and
having a hard time in clearing the
DataGrid contents.

I google the topic then
I found your answer.

Thanks, its a big help!

GOD BLESS!

let me see the code that you bind your Grid with

vuyiswamb 17 Posting Whiz

NO Problem

vuyiswamb 17 Posting Whiz

Good Day

I have posted this question before , i cant find it to continue from it. Let me start from Scratch because i did not find a Solution to this problem.

in my page am using a Treeview Control show like this

http://www.vuyiswamaseko.com/public/Wrong_Display.JPG

and am loading data in SQL like this

http://www.vuyiswamaseko.com/public/Query_Wrong_Display.JPG


and my code behind for loading the control looks like this

public void PopulateTreeFromCurr(int currID)
    {    
        // CurrStructDataSource calls sp_Traverse_Tree which returns an inordered list of nodes for a tree
        IEnumerable result = CurrStructDataSource.Select(DataSourceSelectArguments.Empty);
        // ID, Parent, Child, Description, Level, i
        int Parent, Child;
        CurriculumTreeView.Nodes.Clear();
        
        ArrayList CurrNodes = new ArrayList();

        if (result != null)
        {
            // an ordered set of nodes is given. parent always before current node except for root            
            foreach (System.Data.DataRowView row in result)
            {
                TreeNode newnode = new TreeNode(row["Description"].ToString(), row["NodeID"].ToString());
                CurrNodes.Add(newnode); // should setup a lookup between the id given by the ArrayList and that of the node
                // as we add the nodes, we can set up the hierarchy
                if (row["refParent"].ToString() == "")
                {   // don't have to add the root node to another node-it is the root
                }
                else
                {
                    Parent = Convert.ToInt32(row["refParent"]);
                    Child = Convert.ToInt32(row["ID"]);

                    TreeNode ParentNode = new TreeNode();
                    TreeNode ChildNode = new TreeNode();

                    ParentNode = (TreeNode)CurrNodes[Parent];
                    ChildNode = (TreeNode)CurrNodes[Child];
                    ParentNode.ChildNodes.Add(ChildNode);
                    CurrNodes[Parent] = ParentNode;
                }
            }
            if (CurrNodes.Count > 0)
            {
                // Add the first root compulsory which has all nodes attached to it
                CurriculumTreeView.Nodes.Add((TreeNode)CurrNodes[0]);
                CurriculumTreeView.ExpandAll();
            }
        } …
vuyiswamb 17 Posting Whiz

Thank you for your Help. This has Helped me.

vuyiswamb 17 Posting Whiz

Good Day All

i have a Table with the ID Field that was not an identity Field. This Field has not Duplicates. Now later i want to Change this numeric Field as an Identity Field like this

--STEP 7 ADD THE IDENTITY BACK IN TABLE MTM_ACTV_STAFF
ALTER TABLE [New_Jaco].[dbo].[MTM_ACTV_STAFF]
ALTER COLUMN [ID] IDENTITY(1,1)

but i get an Error that says

Msg 156, Level 15, State 1, Line 3
Incorrect syntax near the keyword 'IDENTITY'.

vuyiswamb 17 Posting Whiz

change select venu from......

Exactly what do you want.
for example for venu 6 you have two id (11,13), for venu 2 who have only one id (4) .
Now tell me what you want to display.

Thanks For your answer. i want display 11,13 only not two because it appears once.

Thanks

vuyiswamb 17 Posting Whiz

group by venu

i get this

Msg 8120, Level 16, State 1, Line 2
Column 'dbo.SOL_ACTV_VENU.ID' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.

and i will try to add it in the select and it will still give me nothing

vuyiswamb 17 Posting Whiz

Good Day All

i have the Following that table

ID  | ACTV |VENU |STUD | TRIES
=====================================
1	1   4	 162	     0
2	4   5	 104	     0
3	8   5	 138	     0
4	15  2	 68	     0
5	15  4	 291	     0
6	21  4	 171	     0
7	22  5	 101	     0
8	27  4	 11	     0
9	28  5	 6	     0
10	31  4	 8	     0
11	32  6	 6	     0 
12	33  4	 308	     0
13	35  6	 68	     0

now i have the Following Query that Tries to find the ID's of the records that appear twice in the "VENU" Field.

SELECT id 
FROM [dbo].SOL_ACTV_VENU
group by  id 
having count(venu) > 1
order by sum(stud)

and it seems that it give me nothing while in the table i see there are records like that

Thanks

vuyiswamb 17 Posting Whiz

Thank yo very much guys. The Problem was that i was Closing the connection in the function ExecuteScalarInThread

Thanks

vuyiswamb 17 Posting Whiz

Good Day All

i have the Following Function

private static void OMEGA_calcActvEqv()
    {
        SqlConnection conn1 = CommonFunctions.getSQLConnectionForThread(THREAD_DATA[0].ToString());
        string SQL = "SELECT MAX(D.OFFS + 1) * MAX(R.OFFS + 1) FROM TBL_ROWS R, TBL_CLMN D; SELECT MAX(OFFS + 1) FROM TBL_ROWS;";
        SqlCommand cmd = new SqlCommand(SQL, conn1);
        SqlDataReader rdr = cmd.ExecuteReader();

        int size = 0;
        if (rdr.Read())
        {
            size = Convert.ToInt32(rdr[0]);
        }

        int maxPeriods = 0;
        if (rdr.NextResult())
        {
            if (rdr.Read())
            {
                maxPeriods = Convert.ToInt32(rdr[0]);
            }
        }
        rdr.Close();

        SQL = "SELECT MEA.EQV [EQV], MEA.ACTV [ACTV] FROM MTM_EQV_ACTV MEA ORDER BY MEA.EQV, MEA.ACTV ";

        if ((THREAD_DATA.Length &gt; 3) &amp;&amp; (THREAD_DATA[3] != null))
        {
            string EQV = CommonFunctions.ExecuteScalarInThread("SELECT MEA.EQV FROM MTM_EQV_ACTV MEA WHERE ACTV=" + THREAD_DATA[3], conn1).ToString();
            SQL = "SELECT MEA.EQV [EQV], MEA.ACTV [ACTV] FROM MTM_EQV_ACTV MEA WHERE EQV='" + EQV + "' ORDER BY MEA.EQV, MEA.ACTV ";
        }

        cmd = new SqlCommand(SQL, conn1);
       <b> rdr = cmd.ExecuteReader();</b>

        string eqvSet = string.Empty;
        List&lt;int&gt; actvs = new List&lt;int&gt;();

        while (rdr.Read())
        {
            if (eqvSet != rdr["EQV"].ToString())
            {
                if (actvs.Count &gt; 1)
                {
                    OMEGA_intersectDomns(actvs, size, maxPeriods);
                }

                actvs.Clear();
                eqvSet = rdr["EQV"].ToString();
                if (!DBNull.Value.Equals(rdr["ACTV"]))
                {
                    actvs.Add(Convert.ToInt32(rdr["ACTV"]));
                }
            }
            else
            {
                if (!DBNull.Value.Equals(rdr["ACTV"]))
                {
                    actvs.Add(Convert.ToInt32(rdr["ACTV"]));
                }
            }
        }

        rdr.Close();

        if (actvs.Count > 1)
        {
            OMEGA_intersectDomns(actvs, size, maxPeriods);
            actvs.Clear();
        }

        conn1.Close();
        conn1.Dispose();
    }

and the Definition of function ExecuteScalarInThread

is

public static object ExecuteScalarInThread(string sql, SqlConnection conn1)
    {
        
        SqlCommand sqlcommand = new SqlCommand(sql, conn1);
        //You need to apply the the connection to the command after connection open
        sqlcommand.CommandType = CommandType.Text;

        object ret = new object();

        if …
vuyiswamb 17 Posting Whiz

That is wonderful it worked.

Thanks

vuyiswamb 17 Posting Whiz

Good Day all

i have the Following Query

DECLARE @CurrentTime DATETIME
SET @CurrentTime = CURRENT_TIMESTAMP
select tr.Descr [Room], tb.Purpose [Purpose], tb.Description [Description],
convert(varchar,datepart(hour,tb.starttime))+':'+convert(varchar,datepart(minute,tb.starttime)) [Start Time],
convert(varchar,datepart(hour,tb.endtime))+':'+convert(varchar,datepart(minute,tb.endtime)) [End Time],
tu.name [Requested by] from tbl_booking tb inner join tbl_resource tr
on tb.resources = tr.id
inner join tbl_user tu on tu.id = tb.RequestedByUser
where (day(startdate) = day(@CurrentTime))and(month(startdate)=month(@CurrentTime))and(year(startdate)=year(@CurrentTime))and(tb.status=1)
order by [Room],[Start Time]

and in the [Start Time]and [End Time] it gives me time that is not Complete

it Gives this

14:0

instead of

14:00

Thanks

vuyiswamb 17 Posting Whiz

Good Day All

I have a ASP.NET app. There is a button one of the pages. I have placed a Break point in the Click event and when i click the Button it does not even go to the Break Point it shows this

[IMG]http://www.tiyaneproperties.co.za/SSIS/Strange.jpg[/IMG]

Thanks

vuyiswamb 17 Posting Whiz

Its the same thing. UNC and the Mapped drive is the same thing. so that will not help. i thought there was another way.

vuyiswamb 17 Posting Whiz

Good Day All

am restoring a Database Programatically in Sql. Now if the backup is located in the remote machine i use a Share

\\Vuyiswa\MyShare\

but i will get the Following Error

Exception caught in: ExecuteStoredProc: The file "\\Vuyiswa\Databases\\REmoteTest33.mdf" is on a network path that is not supported for database files. File 'TNGoedit_Data' cannot be restored to '\\Vuyiswa\Databases\\REmoteTest33.mdf'. Use WITH MOVE to identify a valid location for the file. The file "\\Vuyiswa\Databases\\REmoteTest33_log.ldf" is on a network path that is not supported for database files. File 'TNGoedit_Log' cannot be restored to '\\Vuyiswa\Databases\\REmoteTest33_log.ldf'. Use WITH MOVE to identify a valid location for the file. Problems were identified while planning for the RESTORE statement. Previous messages provide details. RESTORE DATABASE is terminating abnormally. Database 'REmoteTest33' does not exist. Make sure that the name is entered correctly.

Thanks

vuyiswamb 17 Posting Whiz

Good Day all

i have created a Global Variable as depicted in the following Pic

http://www.tiyaneproperties.co.za/SSIS/pic1.JPG

The Following Screen-shot shows how i created my Variable and its Properties

http://www.tiyaneproperties.co.za/SSIS/pic2.JPG

and the Following Screen-shot shows the Script Editor Properties

http://www.tiyaneproperties.co.za/SSIS/pic3.JPG

and the Last pic is the code that write to the XML File

http://www.tiyaneproperties.co.za/SSIS/pic4.JPG

The Variable comes back empty and at the end the file comes back empty. So i added a if statement as you can see to make sure that the part that write to the file has no problems.

Thank you

vuyiswamb 17 Posting Whiz

Good Morning

This is not an Application, so i will not have a BLL or DAL. i have all the Rights to write to the File System. all i need is help to BCP the given query

vuyiswamb 17 Posting Whiz

Good Day All

I have the Following Query

DECLARE @CurrentTime DATETIME
SET @CurrentTime = CURRENT_TIMESTAMP
select tr.Descr [Room], tb.Purpose [Purpose], tb.Description [Description],
convert(varchar,datepart(hour,tb.starttime))+':'+convert(varchar,datepart(minute,tb.starttime)) [Start Time],
convert(varchar,datepart(hour,tb.endtime))+':'+convert(varchar,datepart(minute,tb.endtime)) [End Time],
tu.name [Requested by] from tbl_booking tb inner join tbl_resource tr
on tb.resources = tr.id
inner join tbl_user tu on tu.id = tb.RequestedByUser
where (day(startdate) = day(@CurrentTime))and(month(startdate)=month(@CurrentTime))and(year(startdate)=year(@CurrentTime))and(tb.status=1)
order by [Room],[Start Time]
for xml raw

This creates an XML, but now i want to store it in

C:\X.XML

how can i BCP this Query

Thanks

vuyiswamb 17 Posting Whiz

Good Day All

I have a Package created and hosted in a Machine(Theresa) that has SQL 2008 and i have my Development Machine(Vuyiswa) that has IIS and am Debugging from the my machine. i have a ASP.NET 2.0 App and am executing a Package that in another machine. The First thing i did was to share a directory where the Packages are stored when i install the packages and supplied "Everyone","ASP.NET","Vuyiswa" Accounts permissions to to access this share. i can go into the share from the another machine without any problem. i have a code like this in my ASP.NET App

try
        {
            //Start the SSIS Here
            Application app = new Application();
            Package package = null;
            package = app.LoadPackage(@"D:\Program Files\Microsoft SQL Server\100\DTS\Packages\OMEGA\OMEGA.dtsx", null);
            //@"C:\Program Files (x86)\Microsoft SQL Server\100\DTS\Packages\OMEGA\OMEGA.dtsx", null);
           
            Variables vars = package.Variables;

            vars["Time1"].Value = time;

            vars["Time2"].Value = time;

            vars["Time3"].Value = time;

            vars["TTBLTYPE"].Value = THREAD_DATA[1].ToString();

            //package.Connections["SQLNCLI10.1"].ConnectionString = obj.GetConnectionString(THREAD_DATA[0].ToString());
            //Excute Package
            Microsoft.SqlServer.Dts.Runtime.DTSExecResult results = package.Execute();
          
            if (results == Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure)
            {
                foreach (Microsoft.SqlServer.Dts.Runtime.DtsError local_DtsError in package.Errors)
                {
                   
                    Console.WriteLine("Package Execution results: {0}", local_DtsError.Description.ToString());
                    Console.WriteLine();
                }
            }
           
        }
        catch (DtsException ex)
        {
            Exception = ex.Message;
        }

This execute Fine until the

Microsoft.SqlServer.Dts.Runtime.DTSExecResult results = package.Execute();

it does not stop here , but i trap it here

if (results == Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure)

and the Error am Getting is

"SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80040E4D.\r\nAn OLE DB record is available. Source:\"Microsoft SQL Server Native Client 10.0" Hresult: 0x80040E4D Description: "Login failed for user 'sa'

vuyiswamb 17 Posting Whiz

The Server name cant be localhost. The Server name is the instance of SQL not the name of the Computer. a lot of people confuses this. There is a Difference between Data Source and servername. The Data Source is the SQL instance and the Servername is the name of the computer. in the Data Source should be the servername display when you try to connect to the sql server using SQl management studio. Copy that and put it here and it will work.

Kind Regards


Vuyiswa Maseko

vuyiswamb 17 Posting Whiz

This Query works

select distinct nP.id, nP.NodeID, nP.parent, nP.Description, nRef.ID refParent 
from #Nodes nP
left outer join #Nodes nRef on nP.Parent = nRef.NodeID	-- look up the reference id of the parent
order by nP.id, refParent

but it Brings undesired results , but this one in the treeview control

And this Query from the SQL side gives me Good REsults but it give me an error of indexoutofbounds in my code

select np.id , nP.NodeID, nP.parent, nP.Description, nRef.ID refParent 
from #Nodes nP
left outer join #Nodes nRef on nP.Parent = nRef.NodeID	-- look up the reference id of the parent
order by refParent,np.Description

Can you help me arrange the Order by

vuyiswamb 17 Posting Whiz

Thanks now i have Changed my Code to look like this and its working perfect in SQl when i test it.

select distinct nP.id, nP.NodeID, nP.parent, nP.Description, nRef.ID refParent, np.type 
from #Nodes nP
left outer join #Nodes nRef on nP.Parent = nRef.NodeID	-- look up the reference id of the parent
order by  np.Parent,np.Description,np.NodeID

And it returns

Nodeid   Parent   Description     Type      Curr
==========================================================================================
89	 NULL     Compulsory        1	     10
90	  89	  B1052	            3	     10

4113	89	  B1061	            3	     10
2820      89	  One of	    2	     10
2821	2820	  B1054             3	     10
2822	2820	  B1055             3	     10

and its Good thanks.

am binding the values to a Tree Control like this

public void PopulateTreeFromCurr(int currID)
    {    
        // CurrStructDataSource calls sp_Traverse_Tree which returns an inordered list of nodes for a tree
        IEnumerable result = CurrStructDataSource.Select(DataSourceSelectArguments.Empty);
        // ID, Parent, Child, Description, Level, i
        int Parent, Child;
        CurriculumTreeView.Nodes.Clear();
        
        ArrayList CurrNodes = new ArrayList();

        if (result != null)
        {
            // an ordered set of nodes is given. parent always before current node except for root            
            foreach (System.Data.DataRowView row in result)
            {
                TreeNode newnode = new TreeNode(row["Description"].ToString(), row["NodeID"].ToString());
                CurrNodes.Add(newnode); // should setup a lookup between the id given by the ArrayList and that of the node
                // as we add the nodes, we can set up the hierarchy
                if (row["refParent"].ToString() == "")
                {   // don't have to add the root node to another node-it is the root
                }
                else
                {
                    Parent = Convert.ToInt32(row["Parent"]);
                    Child = Convert.ToInt32(row["ID"]);

                    TreeNode ParentNode = new TreeNode();
                    TreeNode ChildNode = …
vuyiswamb 17 Posting Whiz

Good Day all

it is Probably a long day, i cant think Straight now.

i have a table that looks like this

Nodeid   Parent   Description     Type      Curr
==========================================================================================
89	 NULL     Compulsory        1	     10
90	  89	  B1052	            3	     10
2820      89	  One of	    2	     10

4113	89	  B1061	            3	     10
2821	2820	  B1054             3	     10
2822	2820	  B1055             3	     10

Now the Red Record needs to be on top of "One of" because the Parent is "Compulsary" with the "Parent" = 89. Now Even "One of " has the Same Parent as the red record but if its a "One of " and they have the same parent, then "One of " must always be below the record. What i mean is that if there is a record with a same parent but different Type , the one that has type 2 should go below the one that has type 3 in my query. here is my query

select distinct nP.id, nP.NodeID, nP.parent, nP.Description, nRef.ID refParent, np.type 
 from #Nodes nP
left outer join #Nodes nRef on nP.Parent = nRef.NodeID	-- look up the reference id of the parent
order by  refParent,nP.id,np.type desc

Thank you

vuyiswamb 17 Posting Whiz

Where did you put your Database File ?

vuyiswamb 17 Posting Whiz

You are Welcome. Mark the Thread as Resolved and give one of us a Reputation is we deserve it

Kind Regards

Vuyiswa Maseko

vuyiswamb 17 Posting Whiz

Good Day All

I have a File Format Defined like this

9.0
4
1 SQLCHAR 0 100 "," 0 ExtraField ""
2 SQLCHAR 0 100 "," 1 Descr SQL_Latin1_General_CP1_CI_AS
3 SQLCHAR 0 100 "," 2 ABREV SQL_Latin1_General_CP1_CI_AS

and i use it like this

BULK INSERT dbo.TBL_CMPS FROM  'C:\\UNISA_IMPORT\\Final_Import\\Campuses.csv'
WITH (
      FORMATFILE  = 'C:\Format.DAT',
      FIELDTERMINATOR = ',',
      ROWTERMINATOR = '\n' );

and my Table Defination is like this

CREATE TABLE [dbo].[TBL_CMPS](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[DESCR] [varchar](100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[ABREV] [varchar](100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF

and my Error is

Msg 4823, Level 16, State 1, Line 2
Cannot bulk load. Invalid column number in the format file "C:\Format.DAT".

Thank you

vuyiswamb 17 Posting Whiz

You are Welcome

vuyiswamb 17 Posting Whiz

Look at this Post and tell me if there is still a problem

http://www.daniweb.com/forums/thread138587.html

Kind Regards


Vuyiswa Maseko

vuyiswamb 17 Posting Whiz

Mark the Post as Resovled and give Reputation if i deserve it :)

Kind Regards

Vuyiswa Maseko

vuyiswamb 17 Posting Whiz

It is Very Difficult to Help someone who has not Started something. but logically this means that you need to use a Wizard control and Record the selected Questions and at the end give the results of the Test.

vuyiswamb 17 Posting Whiz

This is not A Correct Approach for a login. This is simple you are Suppose to count the Records that matches the Where Clause and you have included having and Group by clause and that is incorrect. You need a simple statement like this

SELECT COUNT(*) FROM UsersPasswords
WHERE Username = [USERNAMEPARAMER] AND Password =[PASSWORDPARAMTER]

I Have once gave someone an answer , please search any post by me here on the Forum

vuyiswamb 17 Posting Whiz

Good Day

Why dont you mark your Post as Resolved because your post had been resolved here

http://forums.asp.net/p/1477628/3439861.aspx

vuyiswamb 17 Posting Whiz

Good Day

These are two different Technologies,there might be a lot of tools that can convert this for you , but i myself i dont trust them , because a lot of them are not going a good Job. I will advice you to rewrite your application in ASP.NET than trying to use a tool to convert Classic to .NET.

Hope this will help you make decision.

Kind Regards

Vuyiswa Maseko

vuyiswamb 17 Posting Whiz

First thing, go to your toolbox and Add a Calender control , set the visibility to false, and add a textbox where there value will be passed too and a link button to invoke the calender. in the click event of your link button make the visibility of the calender to be true and when a user clicks the Calender , in the Calenders selected event write a code to take the selected date to the textbox and after that a code to change the visibility of the calender control to false.

Hope this helps.

vuyiswamb 17 Posting Whiz

How many web config do you have in your Project ?

Do something for me, so that i can know what is the problem exactly. go to one of the aspx file and right click -- Open with --> Notepad and Tell me what you see there.

Kind Regards


Vuyiswa Maseko