Member Avatar for boydanii86

So i have this method, that accepts data inputs of various types from a web form...now some of them (if not all) can be left empty...and thus insert nothing. now my coding is not allowing it to accept these empty strings, any ideas?

try
{
int id = 2;

bool hasRadio = false;
bool hasRadioVHF = false;

if (chkRadioVHF.Checked == true)
{
hasRadioVHF = true;
}

if (chkRadio.Checked == true)
{
hasRadio = true;
}

vesselLicense.InsertVslLic3(id, txtNavigationEquipmentOne.Text, Convert.ToInt32(txtNavigationEquipmentYearOne.Text ), txtNavigationEquipmentTwo.Text, Convert.ToInt32(txtNavigationEquipmentYearTwo.Text ),
txtNavigationEquipmentThree.Text, Convert.ToInt32(txtNavigationEquipmentYearThree.Te xt), txtNavigationEquipmentOther.Text, Convert.ToInt32(txtNavigationEquipmentYearOther.Te xt), hasRadioVHF, Convert.ToInt32(txtRadioVHFPurchaseYear.Text),
hasRadio, Convert.ToInt32(txtRadioPurchaseYear.Text), Convert.ToInt32(txtCellular.Text), Convert.ToInt32(txtCellularPurchaseYear.Text), txtOther.Text, Convert.ToInt32(txtOtherPurchaseYear.Text),
txtRadioCall.Text, txtEchoSounder.Text, Convert.ToInt32(txtEchoSounderPurchaseYear.Text), txtSonar.Text, Convert.ToInt32(txtSonarPurchaseYear.Text), txtNetSond.Text, Convert.ToInt32(txtNetSondPurchaseYear.Text),
txtFishFinder.Text, Convert.ToInt32(txtFishFinderPurchaseYear.Text), txtRemarks.Text);
}
catch (Exception ex)
{
throw ex;
}

and no the problem is not from the sql/database side...i checked it and is working fine :) any ideas on how i could takle this? thanks!

ps this is not home work help, i'm just learning c# by myself and got stuck :(

use nullable feature in C# 2.0
like

int? x;
x = null; // correct
int y;
y = null; // error
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.