Click here to Skip to main content
15,393,955 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I'm using a data grid in WPF to retrieve information For Employees and using Ms-Access Database And table contain have these fields ID name email. The problem create id (ID is Auto generate. And ID Format is Example 1st Employee ID is E1020 ,2nd Employee ID is E1021 etc) this format i am using.

But Data grid Show id only 20,21,22,23, etc. This is not a correct format of my id,

Please help me

Thanks.
Posted
Updated 15-Apr-12 23:56pm
v2
Comments
Nilesh Patil Kolhapur 16-Apr-12 3:20am
   
give ur query and table data
Roliking 16-Apr-12 3:27am
   
what is the your sql query? what is the query ur using for filling the grid?
Arsalaan Ahmed 16-Apr-12 3:33am
   
con.Open();
OleDbDataAdapter da = new OleDbDataAdapter("Select * from Login",con);
DataSet ds = new DataSet();
da.Fill(ds);
dataGrid1.ItemsSource = ds.Tables[0].DefaultView;
con.Close();
Arsalaan Ahmed 16-Apr-12 4:04am
   
Any One please please please Help me,,
Slacker007 16-Apr-12 5:57am
   
We would love to help you but you have to post some more info (code examples perhaps). I can't answer your question as it is right now.
sravani.v 16-Apr-12 5:59am
   
can you give us sample data of login table?
Arsalaan Ahmed 16-Apr-12 13:34pm
   
Login Table Contain this field
ID Password Name
E1020 12 Arsalan
E1021 13 Arsal
E1022 14 Arsa


And Data Grid Show these Field
ID Password Name
20 12 Arsalan
21 13 Arsal
22 14 Arsa
And My problem is ID. You see the DataGrid And Column ID
And this my Code,,,
con.Open();
OleDbDataAdapter da = new OleDbDataAdapter("Select * from Login",con); DataSet ds = new DataSet();
da.Fill(ds);
dataGrid1.ItemsSource = ds.Tables[0].DefaultView;
con.Close();
Mike Hankey 16-Apr-12 14:21pm
   
Is the data in the DefaultView correct?, and the grid just not mapping correctly?
Arsalaan Ahmed 16-Apr-12 14:49pm
   
What can i do? plz give me a solution,,,,,
Kuldeep B 16-Apr-12 23:51pm
   
Please give details of how you inserting record.Is there any query you written for insert in table.
Arsalaan Ahmed 17-Apr-12 2:32am
   
no...
kevinbrydon 17-Apr-12 3:46am
   
A couple of suggestions to help debug.

1. Try changing the values for the ID e.g. set the ID for Arsalan to "ABCDEF" Does this make any difference to the values in the data grid?

2. Make your select statement more specific e.g. "SELECT ID, Password, Name FROM Login"
Arsalaan Ahmed 17-Apr-12 13:42pm
   
kevinbrydon there is no effect in my Application

1 solution

Hello

I don't think there is any autogenerate ID in Access. There is AutoNumber ID and its type is "Replication ID" or "Long Integer".
   
Comments
Arsalaan Ahmed 17-Apr-12 13:35pm
   
O really,,, tHanku,,,
Shahin Khorshidnia 17-Apr-12 15:54pm
   
O ''' yOuRr WeLcOmE'''

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900