473,320 Members | 1,990 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

What the...?

Got a form that pulls data and allows for the user to enter a
response in a textbox and I have a button that is supposed to push this
reponse text back to the database for that record when clicked. HOWEVER
all that is happening when I do this is the data field that is supposed
to be updated with the text from the textbox goes from being NULL to just
being blank(almost like its updating, but not updating it with the text
in the textbox)
What the heck am I missing here?

Here is my button click code:

Private Sub btnAddResponse_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles btnAddResponse.Click
Dim cnn As SqlConnection = New SqlConnection( _
"Data Source= CLT-SP2K3;Initial
Catalog=LittleProjectSiteDb;" & _
"UID=ronaldmcdonald;PWD=bigmac")
Dim cmdUpdate As SqlCommand = cnn.CreateCommand()
cmdUpdate.CommandType = CommandType.StoredProcedure
cmdUpdate.CommandText = "addresponse"
cmdUpdate.Parameters.Add(New SqlParameter( _
"@ID", SqlDbType.Int, 9))
cmdUpdate.Parameters("@ID").Value = lblTest.Text
cmdUpdate.Parameters.Add(New SqlParameter( _
"@Response", SqlDbType.Char, 200))
cmdUpdate.Parameters("@Response").Value = txtResponse.Text
Dim da As SqlDataAdapter = New SqlDataAdapter
da.UpdateCommand = cmdUpdate
cnn.Open()
cmdUpdate.ExecuteNonQuery()
End Sub

Here is my stored procedure:

CREATE PROCEDURE addresponse
@ID numeric, @Response char(200)
AS
UPDATE WachoviaRFI SET
RFI_Response=@Response
WHERE
RFI_Number=@ID
GO

Nov 18 '05 #1
4 1315
You might want to change couple of things and try,

1. Include the Directions for the parameters.

cmdUpdate.Parameters("@ID").direction =
ParameterDirection.Input

2. I dont think you need these...
Dim da As SqlDataAdapter = New SqlDataAdapter
da.UpdateCommand = cmdUpdate 3. you can change thisDim cmdUpdate As SqlCommand = cnn.CreateCommand()
cmdUpdate.CommandText = "addresponse"
TO
Dim cmdUpdate As SqlCommand
cmdUpdate = new SqlCommand("addresponse",cnn)
Thanks,
-Shan

Dim cnn As SqlConnection = New SqlConnection( _ "Data Source= CLT-SP2K3;Initial
Catalog=LittleProjectSiteDb;" & _
"UID=ronaldmcdonald;PWD=bigmac")
Dim cmdUpdate As SqlCommand = cnn.CreateCommand()
cmdUpdate.CommandType = CommandType.StoredProcedure cmdUpdate.CommandText = "addresponse"
cmdUpdate.Parameters.Add(New SqlParameter( _
"@ID", SqlDbType.Int, 9))
cmdUpdate.Parameters("@ID").Value = lblTest.Text
cmdUpdate.Parameters.Add(New SqlParameter( _
"@Response", SqlDbType.Char, 200))
cmdUpdate.Parameters("@Response").Value = txtResponse.Text Dim da As SqlDataAdapter = New SqlDataAdapter
da.UpdateCommand = cmdUpdate
cnn.Open()
cmdUpdate.ExecuteNonQuery()
End Sub


Dim cnn As SqlConnection = New SqlConnection( _ "Data Source= CLT-SP2K3;Initial
Catalog=LittleProjectSiteDb;" & _
"UID=ronaldmcdonald;PWD=bigmac")
Dim cmdUpdate As SqlCommand = cnn.CreateCommand()
cmdUpdate.CommandType = CommandType.StoredProcedure cmdUpdate.CommandText = "addresponse"
cmdUpdate.Parameters.Add(New SqlParameter( _
"@ID", SqlDbType.Int, 9))
cmdUpdate.Parameters("@ID").Value = lblTest.Text
cmdUpdate.Parameters.Add(New SqlParameter( _
"@Response", SqlDbType.Char, 200))
cmdUpdate.Parameters("@Response").Value = txtResponse.Text Dim da As SqlDataAdapter = New SqlDataAdapter
da.UpdateCommand = cmdUpdate
cnn.Open()
cmdUpdate.ExecuteNonQuery()
End Sub
-----Original Message-----
Got a form that pulls data and allows for the user to enter aresponse in a textbox and I have a button that is supposed to push thisreponse text back to the database for that record when clicked. HOWEVERall that is happening when I do this is the data field that is supposedto be updated with the text from the textbox goes from being NULL to justbeing blank(almost like its updating, but not updating it with the textin the textbox)
What the heck am I missing here?

Here is my button click code:

Private Sub btnAddResponse_Click(ByVal sender As System.Object, ByVal eAs System.EventArgs) Handles btnAddResponse.Click
>

Here is my stored procedure:

CREATE PROCEDURE addresponse
@ID numeric, @Response char(200)
AS
UPDATE WachoviaRFI SET
RFI_Response=@Response
WHERE
RFI_Number=@ID
GO

.

Nov 18 '05 #2
This did not work...Its almost like its not picking up the text that I
type into the Textbox and is just entering in blank data. I.E. ""
Anyone else got any ideas?
TIA,
Bill
"Shan" <an*******@discussions.microsoft.com> wrote in news:0f6d01c3bffe
$a****************@phx.gbl:
You might want to change couple of things and try,

1. Include the Directions for the parameters.

cmdUpdate.Parameters("@ID").direction =
ParameterDirection.Input

2. I dont think you need these...
>>Dim da As SqlDataAdapter = New SqlDataAdapter
>>da.UpdateCommand = cmdUpdate 3. you can change this >>Dim cmdUpdate As SqlCommand = cnn.CreateCommand()
>>cmdUpdate.CommandText = "addresponse"

TO
Dim cmdUpdate As SqlCommand
cmdUpdate = new SqlCommand("addresponse",cnn)
Thanks,
-Shan

Dim cnn As SqlConnection = New SqlConnection( _
"Data Source= CLT-SP2K3;Initial
Catalog=LittleProjectSiteDb;" & _
"UID=ronaldmcdonald;PWD=bigmac")
Dim cmdUpdate As SqlCommand = cnn.CreateCommand()
cmdUpdate.CommandType =

CommandType.StoredProcedure
cmdUpdate.CommandText = "addresponse"
cmdUpdate.Parameters.Add(New SqlParameter( _
"@ID", SqlDbType.Int, 9))
cmdUpdate.Parameters("@ID").Value = lblTest.Text
cmdUpdate.Parameters.Add(New SqlParameter( _
"@Response", SqlDbType.Char, 200))
cmdUpdate.Parameters("@Response").Value =

txtResponse.Text
Dim da As SqlDataAdapter = New SqlDataAdapter
da.UpdateCommand = cmdUpdate
cnn.Open()
cmdUpdate.ExecuteNonQuery()
End Sub




Dim cnn As SqlConnection = New SqlConnection( _
"Data Source= CLT-SP2K3;Initial
Catalog=LittleProjectSiteDb;" & _
"UID=ronaldmcdonald;PWD=bigmac")
Dim cmdUpdate As SqlCommand = cnn.CreateCommand()
cmdUpdate.CommandType =

CommandType.StoredProcedure
cmdUpdate.CommandText = "addresponse"
cmdUpdate.Parameters.Add(New SqlParameter( _
"@ID", SqlDbType.Int, 9))
cmdUpdate.Parameters("@ID").Value = lblTest.Text
cmdUpdate.Parameters.Add(New SqlParameter( _
"@Response", SqlDbType.Char, 200))
cmdUpdate.Parameters("@Response").Value =

txtResponse.Text
Dim da As SqlDataAdapter = New SqlDataAdapter
da.UpdateCommand = cmdUpdate
cnn.Open()
cmdUpdate.ExecuteNonQuery()
End Sub


-----Original Message-----
Got a form that pulls data and allows for the user to

enter a
response in a textbox and I have a button that is

supposed to push this
reponse text back to the database for that record when

clicked. HOWEVER
all that is happening when I do this is the data field

that is supposed
to be updated with the text from the textbox goes from

being NULL to just
being blank(almost like its updating, but not updating it

with the text
in the textbox)
What the heck am I missing here?

Here is my button click code:

Private Sub btnAddResponse_Click(ByVal sender As

System.Object, ByVal e
As System.EventArgs) Handles btnAddResponse.Click
>

Here is my stored procedure:

CREATE PROCEDURE addresponse
@ID numeric, @Response char(200)
AS
UPDATE WachoviaRFI SET
RFI_Response=@Response
WHERE
RFI_Number=@ID
GO

.


Nov 18 '05 #3
Your code looks ok.
Few checks you can do though that might help you pin point
the problem area.

1. Are you looking for postbacks in your Page_Load
function? You may be initializing the form on postbacks
too.
2. Have you checked in debug mode if you are getting
anything from txtResponse.Text.
3. If you have permissions you can turn on SQL profiler
and see what the SQL command that's being passed to the
SQL server from ADO.NET.

HTH,
Suresh.
-----Original Message-----
This did not work...Its almost like its not picking up the text that Itype into the Textbox and is just entering in blank data. I.E. ""Anyone else got any ideas?
TIA,
Bill
"Shan" <an*******@discussions.microsoft.com> wrote in news:0f6d01c3bffe$a****************@phx.gbl:
You might want to change couple of things and try,

1. Include the Directions for the parameters.

cmdUpdate.Parameters("@ID").direction =
ParameterDirection.Input

2. I dont think you need these...
>>Dim da As SqlDataAdapter = New SqlDataAdapter
>>da.UpdateCommand = cmdUpdate

3. you can change this
>>Dim cmdUpdate As SqlCommand = cnn.CreateCommand()
>>cmdUpdate.CommandText = "addresponse"

TO
Dim cmdUpdate As SqlCommand
cmdUpdate = new SqlCommand("addresponse",cnn)
Thanks,
-Shan

Dim cnn As SqlConnection = New SqlConnection( _
"Data Source= CLT-SP2K3;Initial
Catalog=LittleProjectSiteDb;" & _
"UID=ronaldmcdonald;PWD=bigmac")
Dim cmdUpdate As SqlCommand = cnn.CreateCommand () cmdUpdate.CommandType =

CommandType.StoredProcedure
cmdUpdate.CommandText = "addresponse"
cmdUpdate.Parameters.Add(New SqlParameter( _
"@ID", SqlDbType.Int, 9))
cmdUpdate.Parameters("@ID").Value = lblTest.Text
cmdUpdate.Parameters.Add(New SqlParameter( _
"@Response", SqlDbType.Char, 200))
cmdUpdate.Parameters("@Response").Value =

txtResponse.Text
Dim da As SqlDataAdapter = New SqlDataAdapter
da.UpdateCommand = cmdUpdate
cnn.Open()
cmdUpdate.ExecuteNonQuery()
End Sub




Dim cnn As SqlConnection = New SqlConnection( _
"Data Source= CLT-SP2K3;Initial
Catalog=LittleProjectSiteDb;" & _
"UID=ronaldmcdonald;PWD=bigmac")
Dim cmdUpdate As SqlCommand = cnn.CreateCommand () cmdUpdate.CommandType =

CommandType.StoredProcedure
cmdUpdate.CommandText = "addresponse"
cmdUpdate.Parameters.Add(New SqlParameter( _
"@ID", SqlDbType.Int, 9))
cmdUpdate.Parameters("@ID").Value = lblTest.Text
cmdUpdate.Parameters.Add(New SqlParameter( _
"@Response", SqlDbType.Char, 200))
cmdUpdate.Parameters("@Response").Value =

txtResponse.Text
Dim da As SqlDataAdapter = New SqlDataAdapter
da.UpdateCommand = cmdUpdate
cnn.Open()
cmdUpdate.ExecuteNonQuery()
End Sub


-----Original Message-----
Got a form that pulls data and allows for the user
to enter a
response in a textbox and I have a button that is

supposed to push this
reponse text back to the database for that record when

clicked. HOWEVER
all that is happening when I do this is the data field

that is supposed
to be updated with the text from the textbox goes from

being NULL to just
being blank(almost like its updating, but not updating
it with the text
in the textbox)
What the heck am I missing here?

Here is my button click code:

Private Sub btnAddResponse_Click(ByVal sender As

System.Object, ByVal e
As System.EventArgs) Handles btnAddResponse.Click
>
Here is my stored procedure:

CREATE PROCEDURE addresponse
@ID numeric, @Response char(200)
AS
UPDATE WachoviaRFI SET
RFI_Response=@Response
WHERE
RFI_Number=@ID
GO

.


.

Nov 18 '05 #4
Sometimes its the little things that get ya..
I forgot to put in If Not Postback in my page load..

Thanks to all who helped!
"Suresh" <an*******@discussions.microsoft.com> wrote in news:017a01c3c00d
$9****************@phx.gbl:
Your code looks ok.
Few checks you can do though that might help you pin point
the problem area.

1. Are you looking for postbacks in your Page_Load
function? You may be initializing the form on postbacks
too.
2. Have you checked in debug mode if you are getting
anything from txtResponse.Text.
3. If you have permissions you can turn on SQL profiler
and see what the SQL command that's being passed to the
SQL server from ADO.NET.

HTH,
Suresh.
-----Original Message-----
This did not work...Its almost like its not picking up

the text that I
type into the Textbox and is just entering in blank data.

I.E. ""
Anyone else got any ideas?
TIA,
Bill
"Shan" <an*******@discussions.microsoft.com> wrote in

news:0f6d01c3bffe
$a****************@phx.gbl:
You might want to change couple of things and try,

1. Include the Directions for the parameters.

cmdUpdate.Parameters("@ID").direction =
ParameterDirection.Input

2. I dont think you need these...
>>Dim da As SqlDataAdapter = New SqlDataAdapter
>>da.UpdateCommand = cmdUpdate
3. you can change this
>>Dim cmdUpdate As SqlCommand = cnn.CreateCommand()
>>cmdUpdate.CommandText = "addresponse"
TO
Dim cmdUpdate As SqlCommand
cmdUpdate = new SqlCommand("addresponse",cnn)
Thanks,
-Shan

Dim cnn As SqlConnection = New SqlConnection( _
"Data Source= CLT-SP2K3;Initial
Catalog=LittleProjectSiteDb;" & _
"UID=ronaldmcdonald;PWD=bigmac")
Dim cmdUpdate As SqlCommand = cnn.CreateCommand () cmdUpdate.CommandType =
CommandType.StoredProcedure
cmdUpdate.CommandText = "addresponse"
cmdUpdate.Parameters.Add(New SqlParameter( _
"@ID", SqlDbType.Int, 9))
cmdUpdate.Parameters("@ID").Value = lblTest.Text
cmdUpdate.Parameters.Add(New SqlParameter( _
"@Response", SqlDbType.Char, 200))
cmdUpdate.Parameters("@Response").Value =
txtResponse.Text
Dim da As SqlDataAdapter = New SqlDataAdapter
da.UpdateCommand = cmdUpdate
cnn.Open()
cmdUpdate.ExecuteNonQuery()
End Sub



Dim cnn As SqlConnection = New SqlConnection( _
"Data Source= CLT-SP2K3;Initial
Catalog=LittleProjectSiteDb;" & _
"UID=ronaldmcdonald;PWD=bigmac")
Dim cmdUpdate As SqlCommand = cnn.CreateCommand () cmdUpdate.CommandType =
CommandType.StoredProcedure
cmdUpdate.CommandText = "addresponse"
cmdUpdate.Parameters.Add(New SqlParameter( _
"@ID", SqlDbType.Int, 9))
cmdUpdate.Parameters("@ID").Value = lblTest.Text
cmdUpdate.Parameters.Add(New SqlParameter( _
"@Response", SqlDbType.Char, 200))
cmdUpdate.Parameters("@Response").Value =
txtResponse.Text
Dim da As SqlDataAdapter = New SqlDataAdapter
da.UpdateCommand = cmdUpdate
cnn.Open()
cmdUpdate.ExecuteNonQuery()
End Sub


-----Original Message-----
Got a form that pulls data and allows for the user to enter a
response in a textbox and I have a button that is
supposed to push this
reponse text back to the database for that record when
clicked. HOWEVER
all that is happening when I do this is the data field
that is supposed
to be updated with the text from the textbox goes from
being NULL to just
being blank(almost like its updating, but not updating it with the text
in the textbox)
What the heck am I missing here?

Here is my button click code:

Private Sub btnAddResponse_Click(ByVal sender As
System.Object, ByVal e
As System.EventArgs) Handles btnAddResponse.Click
>
Here is my stored procedure:

CREATE PROCEDURE addresponse
@ID numeric, @Response char(200)
AS
UPDATE WachoviaRFI SET
RFI_Response=@Response
WHERE
RFI_Number=@ID
GO

.


.


Nov 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: thecrow | last post by:
Alright, what the hell is going on here? In the following code, I expect the printed result to be: DEBUG: frank's last name is burns. Instead, what I get is: DEBUG: frank's last name is...
220
by: Brandon J. Van Every | last post by:
What's better about Ruby than Python? I'm sure there's something. What is it? This is not a troll. I'm language shopping and I want people's answers. I don't know beans about Ruby or have...
699
by: mike420 | last post by:
I think everyone who used Python will agree that its syntax is the best thing going for it. It is very readable and easy for everyone to learn. But, Python does not a have very good macro...
92
by: Reed L. O'Brien | last post by:
I see rotor was removed for 2.4 and the docs say use an AES module provided separately... Is there a standard module that works alike or an AES module that works alike but with better encryption?...
137
by: Philippe C. Martin | last post by:
I apologize in advance for launching this post but I might get enlightment somehow (PS: I am _very_ agnostic ;-). - 1) I do not consider my intelligence/education above average - 2) I am very...
12
by: Dario | last post by:
The following simple program behaves differently in Windows and Linux . #include <stdexcept> #include <iostream> #include <string> using namespace std; class LogicError : public logic_error {...
125
by: Sarah Tanembaum | last post by:
Beside its an opensource and supported by community, what's the fundamental differences between PostgreSQL and those high-price commercial database (and some are bloated such as Oracle) from...
47
by: Neal | last post by:
Patrick Griffiths weighs in on the CSS vs table layout debate in his blog entry "Tables my ass" - http://www.htmldog.com/ptg/archives/000049.php . A quite good article.
121
by: typingcat | last post by:
First of all, I'm an Asian and I need to input Japanese, Korean and so on. I've tried many PHP IDEs today, but almost non of them supported Unicode (UTF-8) file. I've found that the only Unicode...
8
by: Midnight Java Junkie | last post by:
Dear Colleagues: I feel that the dumbest questions are those that are never asked. I have been given the opportunity to get into .NET. Our organization has a subscription with Microsoft that...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.