 |
| ASP.NET 1.1 As of 10/6/2005, this forum is locked as part of the reorganization described here: http://p2p.wrox.com/topic.asp?TOPIC_ID=35394. No posts have been deleted. Open ongoing discussions from the last week have been moved to either ASP.NET 1.0 and 1.1 Beginners http://p2p.wrox.com/asp-net-1-0-1-1-basics-60/ or ASP.NET 1.0 and 1.1 Professional. http://p2p.wrox.com/forum.asp?FORUM_ID=50. See my sticky post inside for more. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the ASP.NET 1.1 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

February 24th, 2004, 12:49 PM
|
|
Authorized User
|
|
Join Date: Feb 2004
Posts: 63
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
not able to update the table..
Hi. friends
I am usind the following code to update the table.
this event occure when the submit button hits.
Sub submit_Click(ByVal sender As Object, ByVal e As ImageClickEventArgs)
Dim strSQL As String
Dim strStuID As String
Dim Cookie as HttpCookie = Request.Cookies("dashUser")
strSQL = "UPDATE alt_ed_attendance SET ATTEND_RSN= " & txtReason.SelectedItem.Value & " WHERE permnum = " & strStuID & " "
'Dim myConnection As OleDbConnection = New OleDbConnection("PROVIDER=MSDAORA.1;Password="";Us er ID="";Data Source="";Persist Security Info=true")
'Dim myCommand As OleDbDataAdapter = New OleDbDataAdapter(strSQL, myConnection)
'Dim mybuild as OleDbCommandBuilder= new OleDbCommandBuilder(myCommand)
'myCommand.updateCommand = mybuild.GetUpdateCommand()
Dim myConnection As OleDbConnection = New OleDbConnection("PROVIDER=MSDAORA.1;Password="";Us er ID="";Data Source="";Persist Security Info=true")
Dim myCommand As OleDbCommand = New OleDbCommand(strSQL, myConnection)
Dim result
Try
myConnection.Open()
result = myCommand.ExecuteNonQuery
Catch err as Exception
Finally
If (Not myConnection is Nothing) Then
myConnection.Close()
Response.Redirect ("data_taft1.aspx")
End If
End Try
end Sub
if anybody can guide me please .....
Aashish Shah
__________________
Aashish Shah
|
|

February 24th, 2004, 01:13 PM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
What data type is the field ATTEND_RSN? Unless it's a numeric field you'll need to wrap the value in single quotes. Or you could use the parameters collection of the command class.
Peter
------------------------------------------------------
Work smarter, not harder.
|
|

February 24th, 2004, 01:18 PM
|
|
Authorized User
|
|
Join Date: Feb 2004
Posts: 63
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
thanks peter..
it is string .. if have also tried it with wraping it in a single quotes too.. I have tried both the method of connection to data base.
but not able to understand that what is the problem..
did i coded wrong for update query or what ...
I dont understand .. can you help me out for this problme .. It will be grate help of yours... thanks
aashish
Aashish Shah
|
|

February 24th, 2004, 01:21 PM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
What is the actual error you are getting?
|
|

February 24th, 2004, 01:29 PM
|
|
Authorized User
|
|
Join Date: Feb 2004
Posts: 63
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
error is not comming out.. but when I am checking the table when I am running query in PLSQL the data is not there..
thats the problem.. thanks
aashish
Aashish Shah
|
|

February 24th, 2004, 02:17 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
Try
myConnection.Open()
result = myCommand.ExecuteNonQuery
Catch err as Exception
response.write(err.message)
Finally
If (Not myConnection is Nothing) Then
myConnection.Close()
Response.Redirect ("data_taft1.aspx")
End If
End Try
|
|

February 24th, 2004, 02:24 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
Also here is how you can use ado.net to update:
strSQLQuery = "UPDATE [table_name] SET [column_name1]=@YourNamedParameter1, [column_name2]=@YourNamedParameter2 WHERE ([table_name].[id] = 1)"
objCommand = New OleDbCommand(strSQLQuery, objConn)
objCommand.Parameters.Add(New OleDbParameter("@YourNamedParameter1", OleDbType.Date, 25))
objCommand.Parameters("@YourNamedParameter1").Valu e = now()
objCommand.Parameters.Add(New OleDbParameter("@YourNamedParameter2", OleDbType.Char, 100))
objCommand.Parameters("@YourNamedParameter2").Valu e = txtEvent.Text
objConn.Open()
objCommand.ExecuteNonQuery()
objConn.Close()
|
|

February 24th, 2004, 04:11 PM
|
|
Authorized User
|
|
Join Date: Feb 2004
Posts: 63
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
thanks
with the ado.net it work out.. thanks
Aashish Shah
|
|
 |