473,473 Members | 1,843 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

C#NET2008 Verify existing record in SQL SERVER Table

126 New Member
Hullo Friends,
I need your help. Please help me.
While trying to verify an existing record in the SQL SERVER table using the user input on TextBox it generate this error message:

Input string was not in a correct format.

These are the coding where the error was generated:
Expand|Select|Wrap|Line Numbers
  1.  int intReturn = 0;
  2.   string strCity = Convert.ToString(this.txtCityName.Text);
  3.   string strSql = "Select * from TblCityRef where City = '" + strCity + "'";
  4.  
  5.  
  6.   sqlconn = new SqlConnection(connstr);
  7.   sqlcmd = new SqlCommand(strSql, sqlconn);
  8.   sqlconn.Open();
  9.   intReturn = Convert.ToInt32(sqlcmd.ExecuteScalar());    <--Error here    
  10.  
Dec 5 '10 #1
0 1357

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Andrew Davidoff | last post by:
Hello All, I am in the process of examining an existing SQL Server 2000 install and trying to collect all the information I can as far as configuration and other various set-up options. Is...
1
by: Philipp | last post by:
Hey @ all, I have a question: It is possible to convert an existing SQL Server 2000 Database to SQL Server 2005? best wishes!
0
by: Mark | last post by:
All, Excuse the re-post but I have found something which works for the UserID but not for the Password (see previous post below). The problem is I don't understand how it works and therefore...
2
by: Mark Perona | last post by:
I created an ASP.net form with an editable datagrid on it. I can create new records, and update and delete existing records. The problem I have is that I want a field in the grid to be editible...
1
by: gaurkamal | last post by:
I want to delete record in table B when i delete record in Table A both table have a common column. I want to do it using trigger .Can any body give some idea. Table details are. Table A: ...
5
by: smiler2505 | last post by:
Sub cmbENum_AfterUpdate() DoCmd.RunSQL "INSERT INTO tblExa(CCanEnt) SELECT tblCwS.CCanEnt FROM tblCwS WHERE tblCwS.ENum = tblExa.ENum" End Sub Tried that, without success. When I change...
0
by: comp21 | last post by:
Hi, Now, I have retrieved or imported data from excel spreadsheet to vb6 application. Now I want to compare this part of data with the one already existing in mssql2000 server(table name being...
2
by: 09876 | last post by:
Hi: all I understand the difference between dynamic binding and static binding. But I just wonder what is the point to make the distinction between the dynamic binding and static binding. For...
7
by: TG | last post by:
hi! I am trying to create a sql server table from an excel sheet. Here is the code I have: 'This procedure the xlsx file and dumps it to a table in SQL Server
11
by: prashantdixit | last post by:
Hi, I am developing a stock control software. Iam stuck somewhere. I have a form "Add new stock" consisting of combobox, text boxes etc. which is used to add records in a table. I have another...
0
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...
0
Oralloy
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,...
0
jinu1996
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.