vuyiswamb 17 Posting Whiz

Thanks Man it helped

vuyiswamb 17 Posting Whiz

Good Morning All

Am trying to Store the username of the User that will be loged on. choose to use the Profile, and i have done the following from the Web Config file

<profile enabled ="true">			<properties>				<add name ="Username" readOnly ="false" allowAnonymous ="true"/>			</properties>		</profile>

And am Storing the Username to the Profile like this

Profile.UserName = username;

I get an error the C# code that says

property or indexer 'System.web.ProfilerBase.Username' cannot be assigned to--it is read only

Thanks

vuyiswamb 17 Posting Whiz

Good Afternoon All

i think its Firday fever, am tired. I think this Happens sometimes. let me get to the Problem. Am doing an OleDb Project

I have an Access DB and the table is Users , here are the Field and dataType

ID = Autonumber(int)
Firstname = TEXT
LastName = TEXT
Username = TEXT
Password = TEXT
Email = TEXT

Now i have a Function that inserts into these Field from my DAL that is Written like this

public int Register_User(String Firstname, String LastName, String Username, String Password, String Email)
        {
            int Res=0;
            
            con = new OleDbConnection(strcon);

            cmdinsert = new OleDbCommand();

            cmdinsert.CommandText = "insert into Users Values(?,?,?,?,?)";

            cmdinsert.CommandTimeout = 0;

            cmdinsert.CommandType = CommandType.Text;

            cmdinsert.Connection = con;

            cmdinsert.Parameters.Add("Username", OleDbType.VarChar,30).Value = Convert.ToString(Username);

            cmdinsert.Parameters.Add("Password", OleDbType.VarChar,30).Value = Convert.ToString(Password);

            cmdinsert.Parameters.Add("Firstname", OleDbType.VarChar,30).Value = Convert.ToString(Firstname);

            cmdinsert.Parameters.Add("LastName", OleDbType.VarChar,30).Value = Convert.ToString(LastName);

            cmdinsert.Parameters.Add("Email", OleDbType.VarChar, 30).Value = Convert.ToString(Email);

            try
            {
                con.Open();

                Res =(int) cmdinsert.ExecuteScalar();


            }
            catch (OleDbException)
            {
                throw;
            }
            finally
            {
                con.Close();
            }
                 return Res;
        }

When i try to insert , i get an Exception.

Number of query values and destination fields are not the same.

Can you please Point the Problem for me

Thank you :)

vuyiswamb 17 Posting Whiz

hi

I think it will be important to buy a book on introduction to programming

vuyiswamb 17 Posting Whiz

Good Afternoon Guys

Let me start here. i have been Builidng Win App and this was an easy task there. Now i have a Page that has a Datagridview and am Displaying this from a DataTable Through a SP like this

Create Proc [sde].[Check_Active_Valuation]as select LIS_KEY,FUNC_KEY,SUBSTRING(CONVERT(VARCHAR,V2.ADD_DATE,1),1,13)AS [ADD DATE],V2.NEW_IMPROVED_VALUE AS [MARKET VALUE],SUBSTRING(CONVERT(VARCHAR,V2.EFFECTIVE_DATE,1),1,13)AS [EFFECTIVE_DATE]  ,CASE V2.VAL_STATUS_ID WHEN1 THEN 'PREVIOUS' WHEN 2 THEN 'ACTIVE'WHEN 3 THEN 'PROCESSED'WHEN 4 THEN 'COMMITED' END AS [STUTUS]from sde.Property_Summary p1 INNER JOIN SDE.VALUATION V2ON V2.PROPERTY_ID =P1.PROPERTY_IDwhere 1< (select count(v1.val_status_id)from sde.valuation v1where v1.property_id = p1.property_idand v1.archive_date is nullANd v1.val_status_id = 2AND V1.EFFECTIVE_DATE > '2002/07/01')

As you can see my SP, Value of Last Field am Displaying is Derived from the Value of that Field. So now, My Users Will see this on the grid will Previous ,Commited and Processed, and thats Fine, now i cant Edit that,i want my users to be able to Double Click and this Field should turn to be a Combobox and they Should Select the Appropriate between Previous , Processed and Commited, The Save part i can hendle.

Thank you

vuyiswamb 17 Posting Whiz

Yes its Possible , but why would you want to let your users type in a Datagrid. get a Separate textbox to search see this Aricle

http://www.codeproject.com/KB/cs/N-Tier22.aspx

vuyiswamb 17 Posting Whiz

hi

Now Remember that i can only show you the door , you are the only person who have to walk throught it. i have created a substring and displayed them on the Messagebox, you have to assign that to the Array. here is the example code

String myString = @"<RssFeeds<link>http://www.codeguru.com/icom_includes/feeds/codeguru/rss-all.xml</link>
    <title>CodeGuru.com</title>   <description>something</description></RssFeeds><RssFeeds><link>http://lifehacker.com/index.xml</link>
    <title>Lifehacker</title>
    <description>something</description>
  </RssFeeds> ";
   MessageBox.Show(myString.Substring(15, 64)); /*It gave me [url]http://www.codeguru.com/icom_includes/feeds/codeguru/rss-all.xml[/url] */
   MessageBox.Show(myString.Substring(99,12)); //CodeGuru.com

Hope this Helps

vuyiswamb 17 Posting Whiz

Thanks i will consider it

vuyiswamb 17 Posting Whiz

hi bankerrajendra

First you have to Create a Storedprocure that counts the Records that match the username and password,

Create Procedure prclogin_check
(
@User_name varchar(20),
@U_Password varchar(23),
@Results int Output
)
Set @Results = (Select count(*) from User_Table
where User_name =@User_name  and U_Password = @U_Password)

And after you are done with this , you have to do the Following in your C# Code

using System.Data.SqlClient;

String strcon = "User id = sa;Password= topman;Server=myServer;Database=MyDB";
            SqlConnection con = new SqlConnection(strcon);
            SqlCommand cmdselect = new SqlCommand();
            cmdselect.CommandTimeout = 0;
            cmdselect.CommandType = CommandType.StoredProcedure;
            cmdselect.Connection = con;
            cmdselect.CommandText = "prclogin_check";
            cmdselect.Parameters.Add("@Results",SqlDbType.Int,4);
            cmdselect.Parameters["@Results"].Direction = ParameterDirection.Output;
            int Res;

            try
            {
                con.Open();

                cmdselect.ExecuteNonQuery();
                Res = (int)cmdselect.Parameters["@Results"].Value;
                con.Close();

            }
            catch (SqlException e)
            {
                MessageBox.Show(e.Message);
            }

And in your Business logic or in your Form you can create a Function that will test if the Count of Records is greater than 0,if its less than that , then its invalid login

Hope this Helps

vuyiswamb 17 Posting Whiz

I understand what you mean, If you do it for understanding purpose its fine. but man there are a lot of things to learn in .NET than a code behind a winform ,its Simple if you have once done coding in java, you will understand that the code behind the winform , is just declaring a form , telling it how big should it be, where should it display when ran and more, there is nothing interesting about it, but still i understand what you mean.

cool

vuyiswamb 17 Posting Whiz

You see , we are Professionals , we dont work for you. If something is very urgent for , its not for us and its an insult to us. Never and Never ever post such a thing in a Forum. lastly before you post you must Goggle, then one day you will be a Better Programmer. see this

How to Print a Datagridview in C#

Hope it helps

vuyiswamb 17 Posting Whiz

can somebody tell me the codes for updating the datagridview records..
here's what i wanna do.
for example there are 3 columns name , middle , last.
i want to update last but the problem is my datagridview doesnt update and still remain the same record but no errors..

You See , if you dont Show us your Code, we will not know why your update does not work

vuyiswamb 17 Posting Whiz

Technology is something that makes things easier, Why do you want to write code just to have a Form, you can just select a Win Form when you start your Project or Add it

vuyiswamb 17 Posting Whiz

hi All

i realy need your Help. i have a Table named Property, this Table has a Field named "Lis_key" and Attrib_code and "Func_key", my Table can look like this

Lis_key ===========Attrib_code=========================  Func_key======
=====================================================================
01424545                       1212033993                  PV000000
01424545                       Null                        GEOSS001
01424545                       Null                        GEOSS002
01424545                       Null                        GEOSS003

Figuire:1

Now from the Above table, i call records that have Func_key "Parents" and Records that has Func_key "Children". and in my table there are many Parents that have no Children. Am interested in those that have Children. As you can see the Attrib_code of Children is Null, i have this query that Find the Parents that has Children. and its like this

select p1.Attrib_code,p1.Lis_key
from sde.property_Backup p1
where p1.func_key = 'PV000000'
and exists (select 1
		from sde.property_Backup p2
		where p2.lis_key = p1.lis_key
		and substring(p2.func_key,1,5)='GEOSS' And 
		P1.aCTIVE =1)
Lis_key ======Attrib_code============Func_key======
===========================================
01424545        1212033993         PV000000
01424545        1215035993         PV000000
01424545        3599345445         PV000000
01424545        5035934544         PV000000

Figuire:2

and now as you above, table this Parents have Children with a Fun_key that is like "GEOSS", and they are null. i want to Copy a Attrib_code of a Parent to a Child as long as the Lis_key as the same. and the Final results should be like this

Lis_key ======Attrib_code=========Func_key======
============================================
01424545        1212033993         PV000000
01424545        1212033993         GEOSS001
01424545        1212033993         GEOSS002
01424545        1212033993         GEOSS003

No more Nulls for Attrbi_code for GEOSS, So i need an update Statement for the Children.

Thanks

Please Help

vuyiswamb 17 Posting Whiz

hi All

i think the code should look like this

textbox1.databinding[B]s[/B].add("text",me.ds,"master_dept","dept_name[B]"[/B])

hope it helps

vuyiswamb 17 Posting Whiz

i have one Problem, please tell me what should i keep in mind, about the following Errors
"Application uses Value of wrong type for the current operation"

This is th errors in vb6

Set prmNum_key = ComNum_key.CreateParameter("Num_Key", adBigInt _
, adParamInput)

Set prmExtension = ComExtension.CreateParameter("Extension", adBigInt _
, adParamInput, , txtextension.Text)

Set prmCell_ID = ComCell_ID.CreateParameter("Cell_ID", adBigInt _
, adParamInput, , txtcellid.Text)

Set prmActual_Extent = ComActual_Extent.CreateParameter("Actual_Extent", adDouble _
, adParamInput, , txtactualextent.Text)

Set prmLis_key = ComLis_key.CreateParameter("Lis_Key", adChar _
, adParamInput, 50, txtliskey.Text)

Set prmFunc_key = ComFunc_key.CreateParameter("Func_key", adBSTR _
, adParamInput, 8, txtfunckey.Text)


Here is my SQl Procedure code

Create Procedure prcInserting @Num_key varchar(10),@Extension int,@Cell_ID int,
@Actual_Extent float,@Lis_key varchar(50), @Func_key varchar(8)
,@Active bit,@Add_date datetime,@Add_User_ID int,@Spatial_ADD_Date datetime
,@Rateable bit,@Non_Discreet_Valid bit
with recompile
as
insert into Propery(Num_key,Extension,Cell_ID,Actual_Extent,Lis_key,Func_key,Active,Add_date,Add_User_ID,Spatial_ADD_Date,Rateable,Non_Discreet_Valid)
values (@Num_key,@Extension,@Cell_ID,@Actual_Extent,@Lis_key, @Func_key,0,getdate(),1,getdate(),0,0)

And its working only in vb, tell me what to keep in mind with insert procedures that are linked to vb for input

vuyiswamb 17 Posting Whiz

My company is using a third party software designed by other private company. there is a point where there is data redundacny on our tables and it requires me to do the data cleaning. i thought it would be better to fix the incorrect field with the procedure with those filed require a common value. i decided to write a procedure to update those files where there is an mispelled of words. and i have to run that query everyday, i was wondering if the Trigger would help here, if maybe i put my Procedure inside the trigger and when ever a user enters wrong info , it can be triggered?

Help i dont know what option to do am using SQL 2005[IMG]http://www.codeproject.com/script/images/smiley_confused.gif[/IMG]


Vuyiswa

vuyiswamb 17 Posting Whiz

hi Samaru, Please help me out here, i have SQL7 test and development tools disk7 of the MSDN. when i try to install it it gives an error at 90% saying could not read a certain file, this is because of poor network connection. and am installing it as local.what do you think is the problem, because i have been installing SQL from the same cd.

vuyiswamb 17 Posting Whiz

RwCC Thanks for your Reply, this happen the first time, thought it was because there is a spyware, so i formated the partition and install XP from Fresh and install Visual studio and it did the same thing

vuyiswamb 17 Posting Whiz

hi Please help,i have installed Visual studio .net 2003. i code in C#, when i write my code, for example
"Console." imidiately before i complete the statement it closes the application requesting to restart the application, and i wrote my code on a notepad making sure that the code is correct and built the project, after that it brings results and attept to shutdown.

"OSK.EXE"
Error System Failed to Initialize

second error
vcspawn.exe
Application Failed to initialize.
i was writting a code that connects to SQL7 and it did and show the table contents.

Please help

i dont have a spyware, i just installed XP from a formated partition.