Click here to Skip to main content
15,888,610 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i am doing code in c# win form.
create my database customer
is field
cust_id,
cust_name,
cust_type,
cust_Address,
cust_Contact_No

after creating win form and i am inserted data to the database it inserted but at same time i also update this database but it was not refresh. does not show current entry in combobox at the time.
after close this solution and again open this solution it will show.
i want to show this database entry at the same time.

thanks in advance.
Posted
Comments
abbaspirmoradi 17-Sep-13 7:06am    
put your insert and upload code here..
Thanks7872 17-Sep-13 7:08am    
After inserting data into database,you have to rebind the data to control in order to show the updated details
Joezer BH 17-Sep-13 7:12am    
some more details and code please ...
Member 10271164 18-Sep-13 1:57am    
My stored procedure is here
and tell me how to added refresh database code

CREATE Procedure [dbo].[InsertUpdateDelete_customer]
(
@cust_id int,
@cust_name nvarchar(max),
@cust_address nvarchar(max),
@contact_number nvarchar(11),
@cust_type nvarchar(10),

@Param int,
@Output varchar(20) output
)
As
Begin
if(@Param=1)
Begin
if exists(select cust_id from customer where cust_name=@cust_name)
Begin
set @Output='Already Exist'
End
Else
Begin
--if(@Error=0)
--Begin
insert into customer
(
cust_id,
cust_name,
cust_address,
contact_number,
cust_type

)
values
(
@cust_id,
@cust_name,
@cust_address,
@contact_number,
@cust_type
)
set @Output='Inserted'
--End
--Else
--begin
-- set @Error=2
-- print @Error
--End
End

End

if(@Param=2)
Begin
Update customer
set cust_name=@cust_name,

cust_address=@cust_address,
contact_number=@contact_number,
cust_type=@cust_type,

where customer_id=@customer_id or cust_name=@cust_name
set @Output='Updated'
End

if(@Param=3)
Begin
Delete From customer
where customer_id=@customer_id or cust_name=@cust_name
set @Output='Deleted'
End
End


this stored procedure is exixuted but not refresh database it need to refresh database amualy.
Dholakiya Ankit 17-Sep-13 7:13am    
or update only those data which you have updated

1 solution

Are you using DB aware controls or are you retrieving and loading objects? Sounds like you are either not retrieving the updated details or not refreshing at the right time, if at all. Have you got more code to look at?
 
Share this answer
 

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


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