problem updating my database

G

Guest

hi,
i managed to populate my datagris and add a template colum to update the database. when i click the update button i get an error. is there something wrong with my code.


------------------code that populate the grid ar load

Dim conPos As SqlConnection
Dim cmdSel As SqlDataAdapter
Dim ds As DataSet

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here

conPos = New SqlConnection("Server = prod01\enterprise;UID=sa;PWD=xxxx;Database=POS")



If Not Page.IsPostBack Then

BindGrid()

End If

End Sub

-----------------Bind Grid-----------------


Sub BindGrid()


cmdSel = New SqlDataAdapter("LoadOrderRegulation", conPos)

cmdSel.SelectCommand.CommandType = CommandType.StoredProcedure

cmdSel.SelectCommand.Parameters.Add(New SqlParameter("@productName", SqlDbType.VarChar, 15))
cmdSel.SelectCommand.Parameters("@productName").Value = "HELLO!"


ds = New DataSet
cmdSel.Fill(ds, "Oreg")

DataGrid2.DataSource = ds.Tables("Oreg").DefaultView
DataGrid2.DataBind()


End Sub



-----------------here is the update............

' Read values of the row

Dim productNumber As String = productNumber = e.Item.Cells(0).Text
Dim storeNumber As String = storeNumber = e.Item.Cells(1).Text
Dim accountNumber As String = accountNumber = e.Item.Cells(2).Text
Dim adjustment As Integer = CType(e.Item.Cells(7).Controls(0), TextBox).Text


'this is an update stored proc

Dim cmdDA As New SqlDataAdapter("UpdateOrderRegulation", conPos)

cmdSel.UpdateCommand.CommandType = CommandType.StoredProcedure

cmdSel.SelectCommand.Parameters.Add(New SqlParameter("@productNumber", SqlDbType.VarChar, 10))
cmdSel.SelectCommand.Parameters.Add(New SqlParameter("@storeNumber", SqlDbType.VarChar, 10))
cmdSel.SelectCommand.Parameters.Add(New SqlParameter("@accountNumber", SqlDbType.VarChar, 10))
cmdSel.SelectCommand.Parameters.Add(New SqlParameter("@adjustment", SqlDbType.Int))

cmdSel.SelectCommand.Parameters("@productNumber").Value = productNumber
cmdSel.SelectCommand.Parameters("@storeNumber").Value = storeNumber
cmdSel.SelectCommand.Parameters("@accountNumber").Value = accountNumber
cmdSel.SelectCommand.Parameters("@adjustment").Value = adjustment

cmdSel.Update(ds, "Oreg")


DataGrid2.EditItemIndex = -1

BindGrid()



can you guys see anything wrong with my update section.

thanks
 
J

jm

what is the error? sorry if I missed it.
chris said:
hi,
i managed to populate my datagris and add a template colum to update the
database. when i click the update button i get an error. is there something
wrong with my code.
------------------code that populate the grid ar load

Dim conPos As SqlConnection
Dim cmdSel As SqlDataAdapter
Dim ds As DataSet


Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
 
G

Guest

Server Error in '/pos_application' Application
-------------------------------------------------------------------------------

Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.

Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off"

<!-- Web.Config Configuration File --><configuration><system.web><customErrors mode="Off"/></system.web></configuration


Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL

<!-- Web.Config Configuration File --><configuration><system.web><customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/></system.web></configuration


i am on a remote machine. if i am using the sa in connection string do i have to setup any security setting between iis and sql server?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top