![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
This is the first time I've tried to convert my .asp ado connection to the .NET framework and I'm totally lost. I'm trying to add a new record using the code below and am getting an error - BC30518: Overload resolution failed because no accessible 'Update' can be called with these arguments: Dim cnObj as OleDbConnection = New OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0; DATA SOURCE=" & dbPath & ";") Dim daVisitors As OleDbDataAdapter = New OleDbDataAdapter("SELECT * From Visitors", cnObj) Dim dsVisitors As New DataSet() Dim dtVisitors As DataTable Dim drVisitors As DataRow cnObj.Open() daVisitors.Fill(dsVisitors, "Visitors") dtVisitors = dsVisitors.Tables("Visitors") drVisitors = dtVisitors.NewRow() With drVisitors .Item("Field1") = "Some Data" .Item("Field2") = "Some Data 2" End With dtVisitors.Rows.Add(drVisitors) daVisitors.Update(drVisitors) cnObj.Close Because I have little experience with ADO.Net Syntax I'm not even sure if this is the right approach. Any help would be greatly appreciated. CES |
#3
| |||
| |||
|
|
You code there is a select statement and not an update statement. The code below is for an update statement Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click Dim objConn As OleDbConnection Dim objCmd As OleDbCommand objConn = New OleDbConnection(ConfigurationSettings.AppSettings( "DSN")) objCmd = New OleDbCommand("Insert INTO tblCourseNames(CourseName,CourseOutline) VALUES (@CourseName, @CourseOutline)", objConn) objCmd.Parameters.Add("@CourseName", txtCourseName.Text) objCmd.Parameters.Add("@CourseOutline", FreeTextBox1.Text) objConn.Open() objCmd.ExecuteNonQuery() objConn.Close() End Sub This is a attached to a Button event. The line objConn = New OleDbConnection(ConfigurationSettings.AppSettings( "DSN")) references the connection string that is stored in the web.config file like this appSettings add key="dsn" value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Inetpub\wwwroot\TurtleBay\Database\Sched ule.mdb;Persist Security Info=False" / /appSettings -- Regards Paul Whitham Macromedia Certified Professional for Dreamweaver MX2004 Valleybiz Internet Design www.valleybiz.net Team Macromedia Volunteer for Ultradev/Dreamweaver MX www.macromedia.com/support/forums/team_macromedia "CES" <none (AT) none (DOT) com> wrote in message news:cemov6$neb$1 (AT) forums (DOT) macromedia.com... This is the first time I've tried to convert my .asp ado connection to the .NET framework and I'm totally lost. I'm trying to add a new record using the code below and am getting an error - BC30518: Overload resolution failed because no accessible 'Update' can be called with these arguments: Dim cnObj as OleDbConnection = New OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0; DATA SOURCE=" & dbPath & ";") Dim daVisitors As OleDbDataAdapter = New OleDbDataAdapter("SELECT * From Visitors", cnObj) Dim dsVisitors As New DataSet() Dim dtVisitors As DataTable Dim drVisitors As DataRow cnObj.Open() daVisitors.Fill(dsVisitors, "Visitors") dtVisitors = dsVisitors.Tables("Visitors") drVisitors = dtVisitors.NewRow() With drVisitors .Item("Field1") = "Some Data" .Item("Field2") = "Some Data 2" End With dtVisitors.Rows.Add(drVisitors) daVisitors.Update(drVisitors) cnObj.Close Because I have little experience with ADO.Net Syntax I'm not even sure if this is the right approach. Any help would be greatly appreciated. CES |
#4
| |||
| |||
|
|
Paul, Are you accessing a query with in the access Database or are you accessing a Table? I ask becouse I'm geting the following error: ---- Exception Details: System.Data.OleDb.OleDbException: Operation must use an updateable query. ---- If you are going against a Query as I suspect do you know how I would modify your code to allow updating a table??? Thanks CES Dim objConn As OleDbConnection = New OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0; DATA SOURCE=" & dbPath & ";") Dim objCmd As OleDbCommand = New OleDbCommand("Insert INTO visitors(UserNum,BrowserId) VALUES (@UserNum,@BrowserId)", objConn) objCmd.Parameters.Add("@UserNum", "userNum text") objCmd.Parameters.Add("@BrowserId", "BrowserId Text") objConn.Open() objCmd.ExecuteNonQuery() objConn.Close() "Paul Whitham TMM" <paul (AT) valleybiz (DOT) net> wrote in message news:cemsml$qpt$1 (AT) forums (DOT) macromedia.com... You code there is a select statement and not an update statement. The code below is for an update statement Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click Dim objConn As OleDbConnection Dim objCmd As OleDbCommand objConn = New OleDbConnection(ConfigurationSettings.AppSettings( "DSN")) objCmd = New OleDbCommand("Insert INTO tblCourseNames(CourseName,CourseOutline) VALUES (@CourseName, @CourseOutline)", objConn) objCmd.Parameters.Add("@CourseName", txtCourseName.Text) objCmd.Parameters.Add("@CourseOutline", FreeTextBox1.Text) objConn.Open() objCmd.ExecuteNonQuery() objConn.Close() End Sub This is a attached to a Button event. The line objConn = New OleDbConnection(ConfigurationSettings.AppSettings( "DSN")) references the connection string that is stored in the web.config file like this appSettings add key="dsn" value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Inetpub\wwwroot\TurtleBay\Database\Sched ule.mdb;Persist Security Info=False" / /appSettings -- Regards Paul Whitham Macromedia Certified Professional for Dreamweaver MX2004 Valleybiz Internet Design www.valleybiz.net Team Macromedia Volunteer for Ultradev/Dreamweaver MX www.macromedia.com/support/forums/team_macromedia "CES" <none (AT) none (DOT) com> wrote in message news:cemov6$neb$1 (AT) forums (DOT) macromedia.com... This is the first time I've tried to convert my .asp ado connection to the .NET framework and I'm totally lost. I'm trying to add a new record using the code below and am getting an error - BC30518: Overload resolution failed because no accessible 'Update' can be called with these arguments: Dim cnObj as OleDbConnection = New OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0; DATA SOURCE=" & dbPath & ";") Dim daVisitors As OleDbDataAdapter = New OleDbDataAdapter("SELECT * From Visitors", cnObj) Dim dsVisitors As New DataSet() Dim dtVisitors As DataTable Dim drVisitors As DataRow cnObj.Open() daVisitors.Fill(dsVisitors, "Visitors") dtVisitors = dsVisitors.Tables("Visitors") drVisitors = dtVisitors.NewRow() With drVisitors .Item("Field1") = "Some Data" .Item("Field2") = "Some Data 2" End With dtVisitors.Rows.Add(drVisitors) daVisitors.Update(drVisitors) cnObj.Close Because I have little experience with ADO.Net Syntax I'm not even sure if this is the right approach. Any help would be greatly appreciated. CES |
#5
| |||
| |||
|
|
I am accessing a table. The error you are getting is because the database, or the folder it is sitting in, does not have write access enabled for the anonymous .net web client. If this is on a shared host, ask you tech people to correct. If it is on a local machine follow the steps in this tutorial http://www.charon.co.uk/content.aspx?CategoryID=27&ArticleID=56 -- Regards Paul Whitham Macromedia Certified Professional for Dreamweaver MX2004 Valleybiz Internet Design www.valleybiz.net Team Macromedia Volunteer for Ultradev/Dreamweaver MX www.macromedia.com/support/forums/team_macromedia "CES" <none (AT) none (DOT) com> wrote in message news:cemvkg$88$1 (AT) forums (DOT) macromedia.com... Paul, Are you accessing a query with in the access Database or are you accessing a Table? I ask becouse I'm geting the following error: ---- Exception Details: System.Data.OleDb.OleDbException: Operation must use an updateable query. ---- If you are going against a Query as I suspect do you know how I would modify your code to allow updating a table??? Thanks CES Dim objConn As OleDbConnection = New OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0; DATA SOURCE=" & dbPath & ";") Dim objCmd As OleDbCommand = New OleDbCommand("Insert INTO visitors(UserNum,BrowserId) VALUES (@UserNum,@BrowserId)", objConn) objCmd.Parameters.Add("@UserNum", "userNum text") objCmd.Parameters.Add("@BrowserId", "BrowserId Text") objConn.Open() objCmd.ExecuteNonQuery() objConn.Close() "Paul Whitham TMM" <paul (AT) valleybiz (DOT) net> wrote in message news:cemsml$qpt$1 (AT) forums (DOT) macromedia.com... You code there is a select statement and not an update statement. The code below is for an update statement Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click Dim objConn As OleDbConnection Dim objCmd As OleDbCommand objConn = New OleDbConnection(ConfigurationSettings.AppSettings( "DSN")) objCmd = New OleDbCommand("Insert INTO tblCourseNames(CourseName,CourseOutline) VALUES (@CourseName, @CourseOutline)", objConn) objCmd.Parameters.Add("@CourseName", txtCourseName.Text) objCmd.Parameters.Add("@CourseOutline", FreeTextBox1.Text) objConn.Open() objCmd.ExecuteNonQuery() objConn.Close() End Sub This is a attached to a Button event. The line objConn = New OleDbConnection(ConfigurationSettings.AppSettings( "DSN")) references the connection string that is stored in the web.config file like this appSettings add key="dsn" value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Inetpub\wwwroot\TurtleBay\Database\Sched ule.mdb;Persist Security Info=False" / /appSettings -- Regards Paul Whitham Macromedia Certified Professional for Dreamweaver MX2004 Valleybiz Internet Design www.valleybiz.net Team Macromedia Volunteer for Ultradev/Dreamweaver MX www.macromedia.com/support/forums/team_macromedia "CES" <none (AT) none (DOT) com> wrote in message news:cemov6$neb$1 (AT) forums (DOT) macromedia.com... This is the first time I've tried to convert my .asp ado connection to the .NET framework and I'm totally lost. I'm trying to add a new record using the code below and am getting an error - BC30518: Overload resolution failed because no accessible 'Update' can be called with these arguments: Dim cnObj as OleDbConnection = New OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0; DATA SOURCE=" & dbPath & ";") Dim daVisitors As OleDbDataAdapter = New OleDbDataAdapter("SELECT * From Visitors", cnObj) Dim dsVisitors As New DataSet() Dim dtVisitors As DataTable Dim drVisitors As DataRow cnObj.Open() daVisitors.Fill(dsVisitors, "Visitors") dtVisitors = dsVisitors.Tables("Visitors") drVisitors = dtVisitors.NewRow() With drVisitors .Item("Field1") = "Some Data" .Item("Field2") = "Some Data 2" End With dtVisitors.Rows.Add(drVisitors) daVisitors.Update(drVisitors) cnObj.Close Because I have little experience with ADO.Net Syntax I'm not even sure if this is the right approach. Any help would be greatly appreciated. CES |
#6
| |||
| |||
|
|
I am accessing a table. The error you are getting is because the database, or the folder it is sitting in, does not have write access enabled for the anonymous .net web client. If this is on a shared host, ask you tech people to correct. If it is on a local machine follow the steps in this tutorial http://www.charon.co.uk/content.aspx?CategoryID=27&ArticleID=56 -- Regards Paul Whitham Macromedia Certified Professional for Dreamweaver MX2004 Valleybiz Internet Design www.valleybiz.net Team Macromedia Volunteer for Ultradev/Dreamweaver MX www.macromedia.com/support/forums/team_macromedia "CES" <none (AT) none (DOT) com> wrote in message news:cemvkg$88$1 (AT) forums (DOT) macromedia.com... Paul, Are you accessing a query with in the access Database or are you accessing a Table? I ask becouse I'm geting the following error: ---- Exception Details: System.Data.OleDb.OleDbException: Operation must use an updateable query. ---- If you are going against a Query as I suspect do you know how I would modify your code to allow updating a table??? Thanks CES Dim objConn As OleDbConnection = New OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0; DATA SOURCE=" & dbPath & ";") Dim objCmd As OleDbCommand = New OleDbCommand("Insert INTO visitors(UserNum,BrowserId) VALUES (@UserNum,@BrowserId)", objConn) objCmd.Parameters.Add("@UserNum", "userNum text") objCmd.Parameters.Add("@BrowserId", "BrowserId Text") objConn.Open() objCmd.ExecuteNonQuery() objConn.Close() "Paul Whitham TMM" <paul (AT) valleybiz (DOT) net> wrote in message news:cemsml$qpt$1 (AT) forums (DOT) macromedia.com... You code there is a select statement and not an update statement. The code below is for an update statement Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click Dim objConn As OleDbConnection Dim objCmd As OleDbCommand objConn = New OleDbConnection(ConfigurationSettings.AppSettings( "DSN")) objCmd = New OleDbCommand("Insert INTO tblCourseNames(CourseName,CourseOutline) VALUES (@CourseName, @CourseOutline)", objConn) objCmd.Parameters.Add("@CourseName", txtCourseName.Text) objCmd.Parameters.Add("@CourseOutline", FreeTextBox1.Text) objConn.Open() objCmd.ExecuteNonQuery() objConn.Close() End Sub This is a attached to a Button event. The line objConn = New OleDbConnection(ConfigurationSettings.AppSettings( "DSN")) references the connection string that is stored in the web.config file like this appSettings add key="dsn" value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Inetpub\wwwroot\TurtleBay\Database\Sched ule.mdb;Persist Security Info=False" / /appSettings -- Regards Paul Whitham Macromedia Certified Professional for Dreamweaver MX2004 Valleybiz Internet Design www.valleybiz.net Team Macromedia Volunteer for Ultradev/Dreamweaver MX www.macromedia.com/support/forums/team_macromedia "CES" <none (AT) none (DOT) com> wrote in message news:cemov6$neb$1 (AT) forums (DOT) macromedia.com... This is the first time I've tried to convert my .asp ado connection to the .NET framework and I'm totally lost. I'm trying to add a new record using the code below and am getting an error - BC30518: Overload resolution failed because no accessible 'Update' can be called with these arguments: Dim cnObj as OleDbConnection = New OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0; DATA SOURCE=" & dbPath & ";") Dim daVisitors As OleDbDataAdapter = New OleDbDataAdapter("SELECT * From Visitors", cnObj) Dim dsVisitors As New DataSet() Dim dtVisitors As DataTable Dim drVisitors As DataRow cnObj.Open() daVisitors.Fill(dsVisitors, "Visitors") dtVisitors = dsVisitors.Tables("Visitors") drVisitors = dtVisitors.NewRow() With drVisitors .Item("Field1") = "Some Data" .Item("Field2") = "Some Data 2" End With dtVisitors.Rows.Add(drVisitors) daVisitors.Update(drVisitors) cnObj.Close Because I have little experience with ADO.Net Syntax I'm not even sure if this is the right approach. Any help would be greatly appreciated. CES |
#7
| |||
| |||
|
|
Paul, How do you deal with null Values Like if request("UserNum") <> "" Then objCmd.Parameters.Add("@UserNum", "userNum text") End If Thanks CES "Paul Whitham TMM" <paul (AT) valleybiz (DOT) net> wrote in message news:cen1qk$28a$1 (AT) forums (DOT) macromedia.com... I am accessing a table. The error you are getting is because the database, or the folder it is sitting in, does not have write access enabled for the anonymous .net web client. If this is on a shared host, ask you tech people to correct. If it is on a local machine follow the steps in this tutorial http://www.charon.co.uk/content.aspx?CategoryID=27&ArticleID=56 -- Regards Paul Whitham Macromedia Certified Professional for Dreamweaver MX2004 Valleybiz Internet Design www.valleybiz.net Team Macromedia Volunteer for Ultradev/Dreamweaver MX www.macromedia.com/support/forums/team_macromedia "CES" <none (AT) none (DOT) com> wrote in message news:cemvkg$88$1 (AT) forums (DOT) macromedia.com... Paul, Are you accessing a query with in the access Database or are you accessing a Table? I ask becouse I'm geting the following error: ---- Exception Details: System.Data.OleDb.OleDbException: Operation must use an updateable query. ---- If you are going against a Query as I suspect do you know how I would modify your code to allow updating a table??? Thanks CES Dim objConn As OleDbConnection = New OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0; DATA SOURCE=" & dbPath & ";") Dim objCmd As OleDbCommand = New OleDbCommand("Insert INTO visitors(UserNum,BrowserId) VALUES (@UserNum,@BrowserId)", objConn) objCmd.Parameters.Add("@UserNum", "userNum text") objCmd.Parameters.Add("@BrowserId", "BrowserId Text") objConn.Open() objCmd.ExecuteNonQuery() objConn.Close() "Paul Whitham TMM" <paul (AT) valleybiz (DOT) net> wrote in message news:cemsml$qpt$1 (AT) forums (DOT) macromedia.com... You code there is a select statement and not an update statement. The code below is for an update statement Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click Dim objConn As OleDbConnection Dim objCmd As OleDbCommand objConn = New OleDbConnection(ConfigurationSettings.AppSettings( "DSN")) objCmd = New OleDbCommand("Insert INTO tblCourseNames(CourseName,CourseOutline) VALUES (@CourseName, @CourseOutline)", objConn) objCmd.Parameters.Add("@CourseName", txtCourseName.Text) objCmd.Parameters.Add("@CourseOutline", FreeTextBox1.Text) objConn.Open() objCmd.ExecuteNonQuery() objConn.Close() End Sub This is a attached to a Button event. The line objConn = New OleDbConnection(ConfigurationSettings.AppSettings( "DSN")) references the connection string that is stored in the web.config file like this appSettings add key="dsn" value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Inetpub\wwwroot\TurtleBay\Database\Sched ule.mdb;Persist Security Info=False" / /appSettings -- Regards Paul Whitham Macromedia Certified Professional for Dreamweaver MX2004 Valleybiz Internet Design www.valleybiz.net Team Macromedia Volunteer for Ultradev/Dreamweaver MX www.macromedia.com/support/forums/team_macromedia "CES" <none (AT) none (DOT) com> wrote in message news:cemov6$neb$1 (AT) forums (DOT) macromedia.com... This is the first time I've tried to convert my .asp ado connection to the .NET framework and I'm totally lost. I'm trying to add a new record using the code below and am getting an error - BC30518: Overload resolution failed because no accessible 'Update' can be called with these arguments: Dim cnObj as OleDbConnection = New OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0; DATA SOURCE=" & dbPath & ";") Dim daVisitors As OleDbDataAdapter = New OleDbDataAdapter("SELECT * From Visitors", cnObj) Dim dsVisitors As New DataSet() Dim dtVisitors As DataTable Dim drVisitors As DataRow cnObj.Open() daVisitors.Fill(dsVisitors, "Visitors") dtVisitors = dsVisitors.Tables("Visitors") drVisitors = dtVisitors.NewRow() With drVisitors .Item("Field1") = "Some Data" .Item("Field2") = "Some Data 2" End With dtVisitors.Rows.Add(drVisitors) daVisitors.Update(drVisitors) cnObj.Close Because I have little experience with ADO.Net Syntax I'm not even sure if this is the right approach. Any help would be greatly appreciated. CES |
![]() |
| Thread Tools | |
| Display Modes | |
| |