Ask a Question related to ASP.NET General, Design and Development.
-
someone #1
Update to SQL Server is NOT Working
I am using the following code in response to a button press.
SqlConnection sqlConn;
SqlCommand sqlCmd;
sqlUpdate = "update ACCGreatest set Votes = (select Votes
+ 1 from ACCGreatest where PlayerID = " +
Convert.ToInt32(ddlGreatest.SelectedItem.Value.ToS tring()) + ") where
PlayerID = " + Convert.ToInt32(ddlGreatest.SelectedItem.Value);
sqlConn = new
SqlConnection("server=(local);uid=accfb;password=a ccrules;database=ACCFB");
sqlCmd = new SqlCommand(sqlUpdate, sqlConn);
sqlConn.Open();
try
{
sqlCmd.ExecuteNonQuery();
}
catch(SqlException ae)
{
Response.Write("SQL Exception: " + ae.ToString());
}
sqlConn.Close();
Unfortunately, it is not working. Can anyone see why this would be
happening? I can take the update string and use it in the SQL Analyzer
and it works fine. So what gives?
TIA,
Mike
someone Guest
-
CFHTTP not working after 7.0.1 Update
Our current config: Win2K, CFMX7 Standard and have applied the 7.0.1 update. It appears the CFHTTP tag is hanging and we are receiving a HTTP 500 -... -
PHP Update query not working
Hello, I'm using a standard update query and getting an error message. Here is the code: if ((isset($HTTP_POST_VARS)) && ($HTTP_POST_VARS ==... -
Update record not working
Hi, I have developed a cms with php,mysql, apache and have done this on my apache testing server. I uploaded the database to the live server,... -
Update not working :(
Hi, I cant seem to find the problem, I hav an update for which displays items to choose from and then a form at the bottom to enter the model id... -
Template update not working...
Hi! I've been maintaining my site using a previous version of Dreamweaver on an old PC. I've now installed MX on a new PC, and have downloaded the... -
Marina #2
Re: Update to SQL Server is NOT Working
What is the exception you are getting? What is the line number that causes
the issue?
Also, why are you converting a string to an intenger? You are concatenating
strings - so leave it as a string. This may be the cause of your problem.
"someone" <someone@somewhere.com> wrote in message
news:ccljgv4ug9kc3iaab88p45ke0st83r59jj@4ax.com...SqlConnection("server=(local);uid=accfb;password=a ccrules;database=ACCFB");> I am using the following code in response to a button press.
> SqlConnection sqlConn;
> SqlCommand sqlCmd;
>
> sqlUpdate = "update ACCGreatest set Votes = (select Votes
> + 1 from ACCGreatest where PlayerID = " +
> Convert.ToInt32(ddlGreatest.SelectedItem.Value.ToS tring()) + ") where
> PlayerID = " + Convert.ToInt32(ddlGreatest.SelectedItem.Value);
> sqlConn = new
>> sqlCmd = new SqlCommand(sqlUpdate, sqlConn);
> sqlConn.Open();
> try
> {
> sqlCmd.ExecuteNonQuery();
> }
> catch(SqlException ae)
> {
> Response.Write("SQL Exception: " + ae.ToString());
> }
> sqlConn.Close();
>
> Unfortunately, it is not working. Can anyone see why this would be
> happening? I can take the update string and use it in the SQL Analyzer
> and it works fine. So what gives?
>
> TIA,
> Mike
Marina Guest
-
someone #3
Re: Update to SQL Server is NOT Working
The data type in the database is int so I assumed that I needed to
convert it to the appropriate data type.
The weird thing is that it is not throwing an error but still not
performing the update. Does my approach seem reasonable to you?
- Create a connection
- Create a sql command based on the connection
- Open the connection
- Execute a non query
- Close the connection
All seems pretty straight forward to me. I have a datagrid that has
been easier to work with than this!! ARGH
Mike
On Mon, 7 Jul 2003 16:38:57 -0400, "Marina"
<zlatkinam@nospam.hotmail.com> wrote:
>What is the exception you are getting? What is the line number that causes
>the issue?
>
>Also, why are you converting a string to an intenger? You are concatenating
>strings - so leave it as a string. This may be the cause of your problem.
>
>"someone" <someone@somewhere.com> wrote in message
>news:ccljgv4ug9kc3iaab88p45ke0st83r59jj@4ax.com.. .>SqlConnection("server=(local);uid=accfb;password= accrules;database=ACCFB");>> I am using the following code in response to a button press.
>> SqlConnection sqlConn;
>> SqlCommand sqlCmd;
>>
>> sqlUpdate = "update ACCGreatest set Votes = (select Votes
>> + 1 from ACCGreatest where PlayerID = " +
>> Convert.ToInt32(ddlGreatest.SelectedItem.Value.ToS tring()) + ") where
>> PlayerID = " + Convert.ToInt32(ddlGreatest.SelectedItem.Value);
>> sqlConn = new
>>>>> sqlCmd = new SqlCommand(sqlUpdate, sqlConn);
>> sqlConn.Open();
>> try
>> {
>> sqlCmd.ExecuteNonQuery();
>> }
>> catch(SqlException ae)
>> {
>> Response.Write("SQL Exception: " + ae.ToString());
>> }
>> sqlConn.Close();
>>
>> Unfortunately, it is not working. Can anyone see why this would be
>> happening? I can take the update string and use it in the SQL Analyzer
>> and it works fine. So what gives?
>>
>> TIA,
>> Mikesomeone Guest



Reply With Quote

