开发者

Problem in Manual ID Code

My Auto ID is already working. But, I tried a Manual ID code and insert the value in my database.. My Questions is how i able to get the value of the manual id. Yes, it's simple but not in a read only.

Please check my code:

Deleting - Its working!

CMSInsurance oInsuranceDelete = new CMSInsurance();
                            Insurance oInsurance = new Insurance();

                            List<InsuranceLabel> lstName = oInsuranceDelete.RetrieveInsuranceList();
                            foreach (InsuranceLabel item in lstName)
                            {
                                var code = e.CommandArgument;
                                if (item.InsuranceCode.ID == code.ToString())
                                {
                                    oInsurance.InsuranceCode = item.InsuranceCode; //proper getting the value of Insurance Code instead of txtCode.text or  e.CommandArgument
                                    oInsuranceDelete.DeleteInsurance(oInsurance);
                                    bind();
                                }
                            }

Inserting Auto ID code - Its Working!

            oInsurance.Name = txtName.text // for string

            CMSInsurance oCMSInsurance = new CMSnsurance();
            oCMSInsurance.CreateInsurance(oInsurance);

Inserting Manual ID Code - Not working..

    //Get the Manual value of Insurance Code
    //For Insert a New Insurance
    CMSInsurance oCMSInsu开发者_如何学运维ranceManual= new CMSInsurance ();
    List<InsuranceLabel> lstList = oCMSInsuranceManual.RetrieveInsuranceList();
    foreach (InsuranceLabel item in lstList)
    {
        if (item.InsuranceCode.ID != Session["AutoCode"])
        {
        oInsurance.InsuranceCode = item.InsuranceCode; // I can't insert a string like txtCode.. is there anyway to solve this issue? 
        }
    }

Thanks!


Like tSQL, SQL Anywhere does not 'normally' allow for inserts into an identity field:

SQL Server does not allow INSERTs into identity columns unless the identity_insert option is set to on

you can find this and more on SQL at Sybase SQL Anywhere User's Guide

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜