rainynight
Member
Server Error in '/reg' Application.
--------------------------------------------------------------------------------
Syntax error in INSERT INTO statement.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.OleDb.OleDbException: Syntax error in INSERT INTO statement.
Source Error:
Line 54: cb = New OleDbCommandBuilder(da)
Line 55: da.InsertCommand = cb.GetInsertCommand()
Line 56: da.Update(ds, "ali")
Line 57: con.close
Line 58: End Sub
Source File: c:\inetpub\wwwroot\reg\webform1.aspx.vb Line: 56
Stack Trace:
[OleDbException (0x80040e14): Syntax error in INSERT INTO statement.]
System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows, DataTableMapping tableMapping) +1550
System.Data.Common.DbDataAdapter.Update(DataSet dataSet, String srcTable) +152
reg.WebForm1.Button1_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\reg\webform1.aspx.vb:56
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1263
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.0.3705.0; ASP.NET Version:1.0.3705.0
از اين خط ايراد ميگيره : update(ds, "ali")
میگه syntax erorr اخه برای چی؟؟؟؟؟؟
اينم سورسش:
Imports System.Data
Imports System.Data.OleDb
Public Class WebForm1
Inherits System.Web.UI.Page
Protected WithEvents Button1 As System.Web.UI.WebControls.Button
Protected WithEvents name As System.Web.UI.WebControls.TextBox
Protected WithEvents number As System.Web.UI.WebControls.TextBox
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Dim ds As New DataSet()
Dim strsql As String
Dim strcon As String
Dim da As OleDbDataAdapter
Dim con As OleDbConnection
Dim newrow As DataRow
Dim cb As OleDbCommandBuilder
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
strcon = "provider=microsoft.jet.oledb.4.0;" & " data source=/inetpub/wwwroot/db/student.mdb"
strsql = "select * from ali "
con = New OleDbConnection(strcon)
con.Open()
da = New OleDbDataAdapter(strsql, con)
da.Fill(ds, "ali")
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
newrow = ds.Tables("ali").NewRow
newrow("name") = name.Text
newrow("number") = Val(number.Text)
ds.Tables("ali").Rows.Add(newrow)
cb = New OleDbCommandBuilder(da)
da.InsertCommand = cb.GetInsertCommand()
da.Update(ds, "ali")
con.close
End Sub
End Class
--------------------------------------------------------------------------------
Syntax error in INSERT INTO statement.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.OleDb.OleDbException: Syntax error in INSERT INTO statement.
Source Error:
Line 54: cb = New OleDbCommandBuilder(da)
Line 55: da.InsertCommand = cb.GetInsertCommand()
Line 56: da.Update(ds, "ali")
Line 57: con.close
Line 58: End Sub
Source File: c:\inetpub\wwwroot\reg\webform1.aspx.vb Line: 56
Stack Trace:
[OleDbException (0x80040e14): Syntax error in INSERT INTO statement.]
System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows, DataTableMapping tableMapping) +1550
System.Data.Common.DbDataAdapter.Update(DataSet dataSet, String srcTable) +152
reg.WebForm1.Button1_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\reg\webform1.aspx.vb:56
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1263
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.0.3705.0; ASP.NET Version:1.0.3705.0
از اين خط ايراد ميگيره : update(ds, "ali")
میگه syntax erorr اخه برای چی؟؟؟؟؟؟
اينم سورسش:
Imports System.Data
Imports System.Data.OleDb
Public Class WebForm1
Inherits System.Web.UI.Page
Protected WithEvents Button1 As System.Web.UI.WebControls.Button
Protected WithEvents name As System.Web.UI.WebControls.TextBox
Protected WithEvents number As System.Web.UI.WebControls.TextBox
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Dim ds As New DataSet()
Dim strsql As String
Dim strcon As String
Dim da As OleDbDataAdapter
Dim con As OleDbConnection
Dim newrow As DataRow
Dim cb As OleDbCommandBuilder
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
strcon = "provider=microsoft.jet.oledb.4.0;" & " data source=/inetpub/wwwroot/db/student.mdb"
strsql = "select * from ali "
con = New OleDbConnection(strcon)
con.Open()
da = New OleDbDataAdapter(strsql, con)
da.Fill(ds, "ali")
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
newrow = ds.Tables("ali").NewRow
newrow("name") = name.Text
newrow("number") = Val(number.Text)
ds.Tables("ali").Rows.Add(newrow)
cb = New OleDbCommandBuilder(da)
da.InsertCommand = cb.GetInsertCommand()
da.Update(ds, "ali")
con.close
End Sub
End Class