Saving combo box value

vkstarry

New member
Joined
Nov 20, 2011
Messages
2
Programming Experience
Beginner
hello all, i need help.
i'm using devexpress combobox
binding.

Datasource : InvoiceBindingSource
DisplayMember :
SupplierName
ValueMember : IdSupplier

and inside it's property
bindingsource editvalue, i bind SupplierBindingSource - IdSupplier

nah
i'm trying to save that combo box value as idsupplier (not supplier name) into
sqlserver r2 database,

in my adapter, i use this
query,
cmd.CommandText = "insert into Invoice (IdInvoice, Number, Date, 
IdSupplier, Info, CreatedBy, CreatedDate, CreatedTime) " +
"values (@IdInvoice, @Number, @Date, @IdSupplier, @Info, @CreatedBy, @CreatedDate, @CreatedTime)"

cmd.Parameters.Add("@IdInvoice", SqlDbType.BigInt).Value = NewIdMaster
cmd.Parameters.Add("@Number", SqlDbType.VarChar, 100).Value = current("Number")
cmd.Parameters.Add("@Date", SqlDbType.Date).Value = current("Date")
cmd.Parameters.Add("@IdSupplier", SqlDbType.BigInt).Value = current("IdSupplier")
cmd.Parameters.Add("@Info", SqlDbType.VarChar, 1000).Value = current("Info")
cmd.Parameters.Add("@CreatedBy", SqlDbType.VarChar, 100).Value = UserManagement.Global.Variables.Username
cmd.Parameters.Add("@CreatedDate", SqlDbType.Date).Value = DateTime.Now
cmd.Parameters.Add("@CreatedTime", SqlDbType.Time).Value = DateTime.Now.TimeOfDay

in this case, i use
current as datarowview to save it,
current("IdSupplier")
but everytime i
save, IdSupplier value in database is always 0.

i really need help,
thanks before..
smiley_smile.gif
 
really cant understand why youre writing any SQL statements into your code (improper way), when the rest of your terminaology indicates youre doing data access the proper way
Can you post your project for me to take a look? Zip it, delete the BIN and OBJ folders from the zip and upload it, passworded if you wish (and pm me the password)
 
Back
Top