tags:

views:

28

answers:

3

this is part of my code

//Instantiate the object we have to deal with string Name = txtName.Text; string Description = txtDecription.Text; string Topic = txtTopic.Text; string Sponsor = txtSponsor.Text; string Location = txtLocation.Text; System.DateTime StartDate; StartDate= DateTime.Parse(txtStartDate.Text); System.DateTime EndDate = DateTime.Parse(txtEndDate.Text); string URL = txtURL.Text;

     try
     {
        intResult = pBAL.Insert(Name,Description, Topic,Sponsor, Location,StartDate,EndDate,URL);
     }

error:Argumnet 6 and 7 .cannot convert from System .DateTime to 'string Need some help

A: 

Try:

intResult = pBAL.Insert(Name,Description, Topic,Sponsor, Location,StartDate.ToString(),EndDate.ToString(),URL);
Andrew Cooper
A: 

Simple Your function expects string parameter you passing datatime as parameter,

Solution 1: Change this statements

System.DateTime StartDate; StartDate= DateTime.Parse(txtStartDate.Text); 
System.DateTime EndDate = DateTime.Parse(txtEndDate.Text);

to

string StartDate= txtStartDate.Text; 
string EndDate = txtEndDate.Text;

Solution 2: or while passing argument convert datetime object to string object

StartDate.ToString()
EndDate.ToString()

That simple,

Ramakrishnan
THANKS RAMAKRISHNAN ,PROBLEM SOLVED
prince
A: 

i think ramakrishnan is correct

parmarupendra