Error : Value of type 'System.Data.DataTable' cannot be converted to 'String'


I have a compilation error : Value of type 'System.Data.DataTable' cannot be converted to 'String'.
I want to erase all the records in my Access database and update it with a DataTable.
My code lines :
Dim conn As OleDbConnection
Dim da As OleDbDataAdapter
Dim ds As DataSet
Dim sql As String
sql = "SELECT * FROM menu;"
conn = New OleDbConnection( "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA Source=d:\www\tgc\prof_tech\fsthilaire\parametres_site\parametres_site.mdb" )
da = New OleDbDataAdapter(sql, conn)
ds = New DataSet
Dim dt as New DataTable()
Dim dr as DataRow
da.Update(ds, dt)
Thanks :-)
6/23/2004 4:41:32 AM 4679 articles. 0 followers. Follow

1 Replies

Similar Articles

[PageSpeed] 51
Get it on Google Play
Get it on Apple App Store


I found what was th problem. I miss dt = ds.Tables("menu") line.
Thanks :-)
6/23/2004 6:12:31 PM

Similar Artilces:

Error: Value of type 'System.Data.CommandBehavior' cannot be converted to 'System.IAsyncResult'.
  I wrote this code to retrieve data from the database using autocomplete extender control. Dim Dr As SqlDataReaderDim RtData As List(Of String) = New List(Of String) Dr = MysqlCmd.EndExecuteReader(Data.CommandBehavior.CloseConnection) While Dr.Read()RtData.Add(Dr("CustName").ToString()) End While   Plz Help!   regards   yamani     The EndExecuteReader does not take a CommandBehavior.  The BeginExecuteReader does.  Please follow the example on the MSDN documentation:

Value of type 'System.Data.Dataset' cannot be converted to 'String'
I receive the above error for line 57 which is: Address.text = Clientinfo(DropDownlist1.Items(DropDownList1.SelectedIndex).text) I'm trying to take the selected item from the dropdownlist1 and have the data from the query 'Clientinfo' appear using the label control called 'address'. I plan to format it to be used as a mailing address: 123 Street City, State Zip Etc. Obviously I am learning as I go. Can anyone give me an alternative or find my error. Much appreciated. The code is below: Sub Page_Load(Sender As Object, E As EventArgs) If Not Page.IsPostBa...

convert type 'System.Data.DataSet' to 'System.Data.DataTable'
 I got this error  : Cannot implicitly convert type 'System.Data.DataSet' to 'System.Data.DataTable' i have written code like thisDataTable dt = new DataTable(); dt = GetGalleryImages(name); Possibly coz GetGalleryImages returns a dataset and not a datatable? Try: DataSet ds = GetGalleryImages(name); what type does GetGalleryImages return?  If this returns a dataset then you will have to change datatable to dataset, then index the table of the dataset.Please mark as answer if you find helpful.Ustes G....

System.Net.Mail is giving error CS0029: Cannot implicitly convert type 'string' to 'System.Net.Mail.MailAddress'
I'm getting an error while trying to use the wizard to create a form and than pass it the vaibles to Mail. Any help would be much appreciated. SmtpClient smtpClient = new SmtpClient(); MailMessage message = new MailMessage(); try {   message.From = txtEmail.Text; message.To.Add(""); message.Subject = "Feedback"; message.CC.Add(""); message.CC.Add(""); message.IsBodyHtml = false; message.Body = txtMessage.Text; smtpClient.Send(message); lblStatus.Text = "Email successfully sent."; } catch (Exception ex) { lbl...

Cannot implicitly convert type 'System.Data.DataTable' to 'System.Data.Dataset'
I am using an excel spreadsheet as a data source to build a dataset which is then used to populate a grid:  I am getting the following error: Cannot implicitly convert type 'System.Data.DataTable' to 'System.Data.Dataset' Here's my code:private DataSet GetData(String description, String mpnumber, String link) { //MPData will represents the Data in Application Cache. We will use Cache Data //for performance purposes, because MP Information will not change often. I choose // to also use Dataset Filtering instead of SQL Server Filtering. However the DataAccess l...

Value of type 'String' cannot be converted to 'System.Net.Mail.MailAddress'
My code is below:Protected Sub btnSendMsg_OnClick(ByVal Source As Object, ByVal E As EventArgs) Dim myMessage As New System.Net.Mail.MailMessage Dim myAttachment As System.Net.Mail.Attachment Dim myMail As System.Net.Mail.SmtpClient If Page.IsValid() Then myMessage.From = txtFromEmail.Text myMessage.To = txtToEmail.TextWhat can I do to fix this? MailMessage.To represents a collection that you Add addresses to.Dim recipient As MailAddress= new MailAddress(txtToEmail.Text) myMessage.To.Add(recipient)    Mike Banavige~~~~~~~~~~...

Cast from type ''''DBNull'''' to type ''''String'''' is not valid.
How do I avoid getting this error: Cast from type ''''DBNull'''' to type ''''String'''' is not valid. I am trying to get values from the database into a form for updating using a Datareader, SQL is set to allow nulls for certain fields as they are not required but the only way I can get the form to display is by adding a space in SQL. Is there another way around this? Check if it is equal to DBNull.Value first and if it is, don't do the cast.Stanley Tan theSpoke Blog Where in the code does it need to go? I am using the following and it's the profile that isn't always requi...

Error type 'System.Data.DataTable' to type 'PRODUCT_LISTDataTable'
I can't figure this one out. I created new solution in vs2005 from using vs2003 and I have a problem I can't find an answer to. I get the following error that relates to passing a to a dataset.datatable named "ProductList.PRODUCT_LISTDataTable".  It says it can't cast the object from one type to the other, and I've tried "CType" and doesn't work. Error: Unable to cast object of type 'System.Data.DataTable' to type 'PRODUCT_LISTDataTable'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trac...

BC30311: Value of type 'System.Data.SqlClient.SqlDataReader' cannot be converted to 'String'.
Does anyone know what the problem is? Sub Page_Init(sender As Object, e As EventArgs) Dim txtName As New TextBox() Dim txtPart As New TextBox() Dim txtEach As New TextBox() Dim txtTotal1 As New TextBox() Dim txtSubtotal As New TextBox() Dim txtTax As New TextBox() Dim txtShipping As New TextBox() Dim txtTotal2 As New TextBox() Dim prod_id As Integer Dim id As Integer id = Request.Querystring("prod_id") txtName.Text = GetName(id).................this is the problem line phName.C...

BC30311: Value of type 'System.Data.SqlClient.SqlDataReader' cannot be converted to 'String'.
Hello, I am developing a page and when I try to call the function GetName(id) to populate the textbox I get the error. Can anyone explain why I am getting this error? Thank you in advance. Sub Page_Load(sender As Object, e As EventArgs) Dim prod_id As Integer Dim id As Integer id = Request.QueryString("prod_id") Response.Write(id) Dim txtName As New TextBox() txtName.Text = GetName(id) Dim txtPart As New TextBox() Dim txtEach As New TextBox() Dim txtTotal1 As New TextBox() Dim txtSubtotal As New T...

Cannot convert value of parameter 'Course_FK' from 'System.String' to 'System.Guid'
Hi, I'm building a site and I've been trying to accomplish something similar to what is talked about in "Working with Data in ASP.NET 2.0 :: Declarative Parameters" tutorial. Below is the code for my methods from the xsd. I tried to attach a screenshot of my xsd but for some reason I'm not allowed GetAllCourseNames() SELECT        CourseID, NameFROM            Course GetCourseScheduleByCourseID SELECT        ScheduleID, Course_FK, Date, TeeTime, NumberOfPlayersF...

Value of type 'System.Net.Mail.MailMessage' cannot be converted to 'System.Net.Mail.AlternateView'
Trying to create an alternateview to send a txt email with the html formatted email.  I've used string builder to create the whole email, but I get this error.  Any ideas why?  i've bolded the line that throws the error... Dim EmailBodyTxt As New StringBuilder EmailBodyTxt.Append("<html><style type='text/css'>.table{border:solid; border-color:#006666; width:600;} ")EmailBodyTxt.Append("<body><table class='table'><tr><td colspan='2'><h1>Test<br />RESPONSE SYSTEM</h1></td>...

Name: haznen Email: haznenatyahoodotcom Product: Gran Paradiso Alpha 8 Summary: '''''''''''''''''''' Comments: '''''''''''''''''''''''''''''''''''' Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20061204 UGES/ GranParadiso/3.0a1 From URL: Note to readers: Hendrix gives...

Having an error: BC30311: Value of type 'String' cannot be converted to 'System.Web.UI.WebControls.Label'.
Error Message: Compiler Error Message: BC30311: Value of type 'String' cannot be converted to 'System.Web.UI.WebControls.Label'. Line 13: myGetRandom.RetrieveDetails(lblQuestion.text, lblAnswers.text, lblViewCount.text, lblLastUpdated.text) Sub Page_Load Dim myGetRandom as new GetRandom myGetRandom.RetrieveDetails(lblQuestion.text, lblAnswers.text, lblViewCount.text, lblLastUpdated.text) End Sub Code behind Sub RetrieveDetails(lblQuestion as label, _ lblAnswers as label, _ lblViewCount as label, _ lblLastUpdated as...

Web resources about - Error : Value of type 'System.Data.DataTable' cannot be converted to 'String' -

Resources last updated: 12/11/2015 10:36:03 AM