By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,087 Members | 1,520 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,087 IT Pros & Developers. It's quick & easy.

No value given for one or more required parameters.

P: 3
Hi,

The below error is what I am receiving. The code im using is below the error, for the life of me, I can not see where any parameter is missing.....

Server Error in '/FleetcubeNews' Application.
--------------------------------------------------------------------------------

No value given for one or more required parameters.
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: No value given for one or more required parameters.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[OleDbException (0x80040e10): No value given for one or more required parameters.]
System.Data.OleDb.OleDbCommand.ExecuteCommandTextE rrorHandling(Int32 hr)
System.Data.OleDb.OleDbCommand.ExecuteCommandTextF orSingleResult(tagDBPARAMS dbParams, Object& executeResult)
System.Data.OleDb.OleDbCommand.ExecuteCommandText( Object& executeResult)
System.Data.OleDb.OleDbCommand.ExecuteCommand(Comm andBehavior behavior, Object& executeResult)
System.Data.OleDb.OleDbCommand.ExecuteReaderIntern al(CommandBehavior behavior, String method)
System.Data.OleDb.OleDbCommand.ExecuteNonQuery()
FleetcubeNews.insert.addstory_Click(Object sender, EventArgs e)
System.Web.UI.WebControls.Button.OnClick(EventArgs e)
System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData)
System.Web.UI.Page.ProcessRequestMain()




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.2407; ASP.NET Version:1.1.4322.2407

Private Function uploadFile() As Boolean

Dim path As String = Server.MapPath("~") & "/assets/images/"
Dim fileOK As Boolean = False

Dim fileExtension As String = System.IO.Path.GetExtension(upload.PostedFile.File Name).ToLower()
Dim allowedExtensions As String() = {".jpg", ".jpeg", ".png", ".gif"}

For i As Integer = 0 To allowedExtensions.Length - 1
If fileExtension = allowedExtensions(i) Then

fileOK = True

End If

Next

If fileOK = True Then

' Try

'upload.PostedFile.SaveAs(path & upload.PostedFile.FileName)

' upload.PostedFile.SaveAs("/FleetcubeNews/assets/images/" & upload.PostedFile.FileName)

upload.PostedFile.SaveAs(path & System.IO.Path.GetFileName(upload.PostedFile.FileN ame))

' Return True

' Catch ex As Exception

' Response.Write("<b>File could not be uploaded.</b><br/>")

' Return False

' End Try

' Else

' Response.Write("<b>Cannot accept files of this type.</b><br/>")

' Return False

End If

End Function

Private Sub addstory_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles addstory.Click
If headline.Text.Length > 0 AndAlso intro.Text.Length > 0 AndAlso story.Text.Length > 0 AndAlso start.Text.Length > 0 Then

'insert

Dim er As Boolean

Dim conn As New OleDb.OleDbConnection(System.Configuration.Configu rationSettings.AppSettings.Get("newsConn"))
Dim com As New OleDb.OleDbCommand

'dim qs as String = ""

com.CommandText = "insert into story(headline, intro, story, typeid, makeid, start) " _

& "values(?,?,?,?,?,?)"

com.Connection = conn

com.Parameters.Add("@h", OleDb.OleDbType.VarChar).Value = headline.Text

com.Parameters.Add("@i", OleDb.OleDbType.VarChar).Value = intro.Text

com.Parameters.Add("@s", OleDb.OleDbType.VarChar).Value = story.Text

com.Parameters.Add("@t", OleDb.OleDbType.Integer).Value = type.SelectedValue

com.Parameters.Add("@m", OleDb.OleDbType.Integer).Value = make.SelectedValue

com.Parameters.Add("@d", OleDb.OleDbType.Date).Value = start.Text

'Dim ps As String

If upload.Value <> "" Then

com.CommandText = "insert into story(headline, intro, story, typeid, makeid, start, path) " _

& "values(?,?,?,?,?,?,?)"

'upload, then return filename

If uploadFile() Then

Response.Write("ss" & upload.PostedFile.FileName)

com.Parameters.Add("@p", OleDb.OleDbType.VarChar).Value = upload.PostedFile.FileName

Else

' top.Text = "An error has ocurred. Please try again.<br/>(upload failed)"

End If

End If


' Try

com.Connection.Open()

com.ExecuteNonQuery()

' Catch ex As Exception

' Response.Write(ex.Message)

' er = True

' End Try

com.Connection.Close()

If Not er Then

addstory.Enabled = False

top.ForeColor = System.Drawing.Color.Blue

top.Text = "The story has been added."

Else

top.Text = "Please try again."

End If

Else

top.Text = "All fields are required."

End If

End Sub



I thank you for any assistance given :)

From a friend in need
Oct 17 '07 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.