Monday, March 26, 2012
Please Help
I can get the data out alright and display it, however the problem occurs when the user goes to add a comment.
Everything works fine. The user puts all the info in and then clicks on the submit button. It seems that it works. But when the page refreshes the data is not there.
I think there must be something wrong with the add function.
Could some one please help me out as I am at the end of my witts.
The code is below. Cheers,
Public Function Add(ByVal Author As String, ByVal Email As String, _
ByVal Homepage As String, ByVal State As String, ByVal Comment As String) As Boolean
Dim sql As String = "INSERT INTO Comments (Author, Email, Homepage, State, Comment) "
sql += "VALUES (@dotnet.itags.org.Author, @dotnet.itags.org.Email, @dotnet.itags.org.Homepage, @dotnet.itags.org.State, @dotnet.itags.org.Comment)"
' create a new OleDbCommand and set its params
Dim myCmd As OleDbCommand = New OleDbCommand(sql, _Connection)
myCmd.Parameters.Add(New OleDbParameter("@dotnet.itags.org.Author", OleDbType.VarChar, 50))
myCmd.Parameters("@dotnet.itags.org.Author").Value = Author.Trim()
myCmd.Parameters.Add(New OleDbParameter("@dotnet.itags.org.Email", OleDbType.VarChar, 50))
myCmd.Parameters("@dotnet.itags.org.Email").Value = Email.Trim()
myCmd.Parameters.Add(New OleDbParameter("@dotnet.itags.org.Homepage", OleDbType.VarChar, 100))
myCmd.Parameters("@dotnet.itags.org.Homepage").Value = Homepage.Trim()
myCmd.Parameters.Add(New OleDbParameter("@dotnet.itags.org.State", OleDbType.VarChar, 50))
myCmd.Parameters("@dotnet.itags.org.State").Value = State.Trim()
myCmd.Parameters.Add(New OleDbParameter("@dotnet.itags.org.Comment", OleDbType.VarChar))
myCmd.Parameters("@dotnet.itags.org.Comment").Value = EncodeHTMLText(Comment.Trim())
Add = True
myCmd.Connection.Open()
Try
myCmd.ExecuteNonQuery()
Catch e As OleDbException
Add = False
Finally
myCmd.Connection.Close()
End Try
End FunctionHave you tried using ? instead of @.paramname:-
Dim sql As String = "INSERT INTO Comments (Author, Email, Homepage, State, Comment) "
sql &= "VALUES (?, ?, ?, ?, ?)"
I gave up and re wrote the form using ADODB. My code is below. If any one has any ways to improve please tell me.
Thankx for your help....
Dim rs As ADODB.Recordset
rs = New ADODB.Recordset()
rs.CursorType = ADODB.CursorTypeEnum.adOpenKeyset
rs.LockType = ADODB.LockTypeEnum.adLockOptimistic
rs.Open("Comments", "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\webspace\myweb.com\db\Guestbook.mdb;Persist Security Info=False;", , , ADODB.CommandTypeEnum.adCmdTable)
rs.AddNew()
rs.Fields(1).Value = Author.Text
rs.Fields(2).Value = Email.Text
rs.Fields(3).Value = Homepage.Text
rs.Fields(4).Value = State.Text
rs.Fields(5).Value = Comment.Text
rs.Update()
rs.Close()
rs = Nothing
Friday, March 16, 2012
please help me with ASP.net problems
Dear Sirs,
I'm a Vietnamese student. I've been developing a website for my school; as not a professional web programer, I have some problems using the language ASP.net. I'd be grapeful if you'd help me to solve some of the following troubles:
- I use a tool on left-hand toolbar called "file field" to upload a picture to a folder on the web server but I don't know what commands to be used to delete it from this folder?
- I call a confirmation box (in VB language) but I receive an error message: "It is invalid to show a modal dialog or form when the application is not running in UserInteractive mode"?
- What commands to hide or disable the back & next buttons in web browser?
Thank you for your help !
Luong trung Kien
Wellcome on asp.net forums.....Here are your answers
1 - u use Input/output libarary , here is the reference ... http://aspnet.4guysfromrolla.com/articles/051802-1.aspx
2 - In Windows base application use, MsgBox(Prompt, Buttons,Title)
and in Web based application used Javascript message box
also see this link for reference , http://www.programmersheaven.com/mb/VBNET/161205/161205/readmessage.aspx
3 - simply used this command in code behind, BUTTON_NAME.visible = False (for hide) & BUTTON_NAME.enabled = False (For Disabled), and also u can perform this activity through designer.........
Happy Programming !
Sajjad
Hi,
The answers to your first and second questions are given above.
But for 3) - There is no way of disabling the back/forward button in a web browser, and nor should you try! The back/forward buttons are so important to web browsing that no web application should function without them. Most users on the web rely on the back/forward buttons for navigation - you should think of them as an asset rather than a problem.
Rich
please help me..... sms service
Hi evrybody, I am developing a website using asp.net with VB.net and access database.. the website is almost completed...but i have to finish one more small part. the website administrator should be able to send sms to the mobile number exist in the DB. i know that we should register to some sms provider which will supplement us with a user name and password.. I dont know how to implement it yet... and i have no clue about doing that.. I dont want to register to the sms provider yet since i am still working in the demo and i did not sell the website yet.. but i have this idea.. i hope if it will work. i have a DSL account in saudi.net (my.saudi.net.sa) company that provide me with username, pass, and numbers of free sms message and i am thinking to use them instead of creating an account in some provider. i hope if you help me in coding that to send sms message through my website using my account in saudinet. if my idea does not work, then please advice me for a provider and the code to send it if possible.. all what i can add here is that my work is stopped because of that and i will really appreciate any help here.. and please i am in hurry :)
Do you have console access to your site? If so create a queue table within your database as that your web application writes to this table. Then write a windows service to read this queue and call the SMS provider. Thus you can easily change the SMS provider.
Consuming such a web service is relatively easy, just import the wsdl to create a web reference and explore the resulting methods. It does help if the SMS provider gives you some sample code for their service. Code for other SMS providers will probably have a different interface and thus unlikely to be of help.
Hello,
This may be helpful to you,