I have two problem.
1) My insert statement here is not working.
It is not inserting value into the database. I am not getting any error message but I can not figured out why it is not inserting the value into database.
Please help me it is very urgent.
Thank You, -
int max = 0;
-
sqidate = DateTime.Now.ToString("yyMM");
-
Response.Write("Today's date is:" +sqidate);
-
int qdate = Convert.ToInt32(sqidate);
-
SqlCommand qicmd = new SqlCommand();
-
//SqlDataReader qireader = new SqlDataReader();
-
qicmd.Connection = sqlConnection1;
-
qicmd.Connection.Open();
-
qicmd.CommandText = " select QI_TRACK from gingercqi where QI_TRACK like '"+qdate+"%' ";
-
qicmd.ExecuteNonQuery();
-
SqlDataReader qireader = qicmd.ExecuteReader();
-
-
int temp = -1;
-
-
if(!qireader.Read())
-
{
-
txtqitrack.Text = sqidate + 01;
-
qicmd.CommandText = "insert into gingercqi(QI_TRACK) values ('"+txtqitrack.Text+"')";
-
}
-
-
qireader.Close();
-
qicmd.Connection.Close();
-
-
(Problem 2)
-
can I write insert statement like this: using a where clause.
-
-
cmd.CommandText = "insert into gingercqi (QI_TRACK,DATE_RCV,INC_NUM,INC_DATE,INC_TIME,QANUM,BASE_HSP,ISSUE_IDENTIFY,MICN_INVOLVED,[1ST_RESP1],[1ST_RESP2],TRANSPORT1) VALUES ('"+txtqitrack.Text+"','"+Datercv.SelectedDate+"','"+ txtincnum.Text+"','"+ Dateinc.SelectedDate+"','"+txtinctime.Text+"','"+txtqanum.Text+"','"+ dpbasehsp.SelectedValue +"','"+dpissueidentify.SelectedValue+"','"+txtmicninvl.Text+"','"+txt1stresp1.Text+"','"+txt1stresp2.Text+"','"+txttransport1.Text+"') where QI_TRACk = '"+txtqitrack.Text+"'";
-
Thank You,
1 1057
I think that !!
you Open Sql and try query - with your query
if you can run in SQL - after you run in C#
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Jason Callas |
last post by:
I have a stored procedure that runs as a step in a scheduled job. For
some reason the job does not seem to finish when ran from the job but
does fine when run from a window in SQL Query.
I know the job is not working because the number of rows that are
inserted into the table (see code) is considerably less than the manual
runnning of it.
I have included the code for the stored procedure, the output from the
job, and the output from...
|
by: Ritesh |
last post by:
Hi All,
According to my observation using SP_WHO2 in my database, some INSERT
statements are getting blocked by SELECT statements. Though the
blocking
SELECT statement is having ReadPast hint, i think, it will only read
past
locked resources but will not guarantee the select statement itself not
blocking other statements(in my case Insert). According to my knowledge
|
by: Dani |
last post by:
Hi everyone
Description of the problem:
Using a PreparedStatement to write down an integer (int) plus a
timestamp for testing purposes. When read out again the integer looks
very different. We found that it was shifted three Bytes to the left,
i.e. 4 becomes hex 4000000 which is 67108864 in decimal base. This
means that the value written and the value read sometimes do not
match, which is of course inacceptable for all real world...
|
by: Bradley Burton |
last post by:
I'm using Allen Brown's code for audit logging
(http://allenbrowne.com/AppAudit.html), but I'm having a problem. My aud
table doesn't populate with the tracking info at all. I think it might be a
problem with the table set-up. I just can't find the problem. These are
the fields in my table:
Table1
ID (primary key) AutoNumber
|
by: alexmaster_2004 |
last post by:
hi
i have made an application using C# that access sql2000.
this application is just used to insert data to the database.
i use something like this in my code:
//
string colmnA = TextBox1.Text;
string comlnB = TextBox2.Text;
string sqlstatment = "INSERT INTO TABLENAME VALUES(" +"'"+colmnA+"'" + "," +
"'" + colmnB + "'" + ")";
| |
by: Jack |
last post by:
Hi,
I am gathering the input values to a form using Request.form method from the
processing page. After all the data is captured, I am building sql statement
out of it. Using a response.write statement, I am generating the output of
the sql statement which I can ran against the table to insert the row.
However, when I am trying to programmatically use the sql statement for the
insert, I am having the following error:
Error Type:...
|
by: mob1012 via DBMonster.com |
last post by:
Hi All,
I wrote last week about a trigger problem I was having. I want a trigger to
produce a unique id to be used as a primary key for my table. I used the
advice I received, but the trigger is still not working correctly. Here is my
code:
create trigger emp_update_id
BEFORE update on emp_update
REFERENCING NEW AS N for each row
SET unique_id = Generate_unique();
|
by: b_r |
last post by:
Hi,
I'm trying to make a simple operation (insert into DB) in VB 2005 and
SQL Server.
The code is as follows:
Dim sConnectionString As String = _
"Data
Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\DB.mdf....
|
by: Red |
last post by:
If auto-format is turned off in VS2008, there is apparently no way to
indent a line. Under Tools->Options->Text Editor->C#->Formatting,
there are three checkboxes. Unchecking those seems to cause this
behavior.
I'd simply like to have the tab key insert a tab at the beginning of a
line. I believe that there were publlished macros for doing this in
earlier VS versions, but I expected this to be 'fixed' in VS2008. Yes,
I realize someone...
|
by: Maklar60 |
last post by:
I am attempting to execute an INSERT statement on my page but continually get the following error:
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
Incorrect syntax near '<'.
/int_code04/myNMLC/insertNewTrackRecord.asp, line 97
I've tested the INSERT stmt both within SQL Server and as a string literal within the page's code with hardcoded values to ensure that the statement works, which is does. But when I assign this...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
| |
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |