How do I remove data from the right side of a number in a text box used for an Insert?

I have a drop down list that contains hard coded numbers i.e 1230PAN, 1230PRO, 5801PDV etc. These numbers can be successfully Inserted into my db. I now need to add a description to each 'AccountNo' but do not want it to be Inserted along with the number. How can I go about inserting the 7characters of the Account No without including the description?
<asp:DropDownList ID="ddlAccountNo" runat="server" Style="position: static" Width="158px" Visible="False">
                            <asp:ListItem Value="--SELECT ACCOUNT--" Style='color:red'></asp:ListItem>
string commandString4 = "INSERT INTO P_AMASTER(ACCOUNTNO) " +
                    "Values (:AccountNO)";
OracleParameter accountParam = new OracleParameter(":AccountNO", OracleType.VarChar, 200);
            accountParam.Value = ddlAccountNo.SelectedValue;

Open in new window

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dirk HaestProject managerCommented:
Can you give an example of what you exactly want (the value you put in, and the thing you want)

String..::.Substring Method (Int32, Int32)
accountParam.Value = ddlAccountNo.SelectedValue.ToString().SubString(0,7)
dwezilAuthor Commented:
1230PAN Displays - PANORAMA

I only want the 1230PAN part, the problem is the string length differs per account number because the descriptions are different in length
Dirk HaestProject managerCommented:
Is your string that you want always 7 chars ?
If yes: accountParam.Value = ddlAccountNo.SelectedValue.SubString(0,7)

Is your string always left from a specific character (for example a space)
If yes: accountParam.Value = ddlAccountNo.SelectedValue.SubString(0, ddlAccountNo.SelectedValue.IndexOf(" "))

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
I am not sure i understood your problem correctly, but if u want to have a text for each item and when updating u want to upadte a value then u can use dropdownlist DataValueField and Datatextfield properties.
dwezilAuthor Commented:
Thanks buddy
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.