asp.net mobile phone number attribution to the query code (1/2)

Source: Internet
Author: User
CREATE TABLE T_phone
(
ID int identity (1,1) not null primary key,
Startno varchar (one) is not NULL,
Endno varchar (one) is not NULL,
CityName nvarchar (m) NOT NULL
)

User Inquiries

SqlConnection con = new SqlConnection (system.configuration.configurationmanager.connectionstrings["Conn"].tostring ());
Con.open ();
String strtestno = This.userphoneno.text.trim ();
SqlCommand cmd = new SqlCommand ();
Cmd.connection = con;
Cmd.commandtext = "Select CityName from T_phone where startno<= @no and Endno >= @no";
SqlParameter sp = new SqlParameter ("@no", SqlDbType.VarChar, 50);
Sp.value = Strtestno;
Cmd.parameters.add (SP);
Object OB = Cmd.executescalar ();
MessageBox.Show (Ob.tostring ());

Home 1 2 last page
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.