473,320 Members | 1,952 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.

Inserting range of values

Hi friends,

Im using a tabel with column names (timefrom, timeto, extension) .For this tabel im inserting the values using stored procedure...
how to insert values if extension has range of values like (100 - 150)

Following is my code:

Expand|Select|Wrap|Line Numbers
  1.                                 con.Open();
  2.                                     SqlCommand cmd=new SqlCommand("AddToDatabase",con);
  3.                                     cmd.CommandType=CommandType.StoredProcedure;
  4.                                     SqlParameter p0=new SqlParameter();
  5.                                     p0.ParameterName="@TimeFrom";
  6.                                     p0.SqlDbType=SqlDbType.DateTime;
  7.                                     p0.Size=50;
  8.                                     p0.Value=TimeFrom1;
  9.                                     cmd.Parameters.Add(p0);
  10.                                     SqlParameter p1=new SqlParameter();
  11.                                     p1.ParameterName="@TimeTo";
  12.                                     p1.SqlDbType=SqlDbType.DateTime;
  13.                                     p1.Value=TimeTo1;
  14.                                     cmd.Parameters.Add(p1);
  15.                                     SqlParameter p2=new SqlParameter();
  16.                                     p2.ParameterName="@Extension";
  17.                                     p2.SqlDbType=SqlDbType.VarChar;
  18.                                     p2.Size=255;
  19.                                     p2.Value=txtlineException.Text.ToString();
  20.                                     cmd.Parameters.Add(p2);
  21.                                     cmd.ExecuteNonQuery();
  22.                                     con.Close();

Thanks in advance :)
Aug 23 '08 #1
1 1060
dmj07
55
Try setting a where clause on your stored procedure e.g.

Expand|Select|Wrap|Line Numbers
  1. SELECT *
  2. FROM table
  3. WHERE (extension >= 50) AND (extension <=100)
  4.  
Aug 26 '08 #2

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

Similar topics

2
by: Bertrand | last post by:
Hello, I am trying to archieve the following: - copy an excel file present on the server - insert values into named ranges of the copy I am using Excel97 on my PC, the server does not have...
16
by: Tim Davidge | last post by:
Hi folks, been a while since I have posted a plea for help and I think I have forgotten everything I learnt from the helpful contributors to this newsgroup, that said however : I'm trying to...
1
by: ajk | last post by:
. Hi, All: I know how to insert files into a Word doc using C#. However, the program I've written to do this runs much too slowly. The "myObj".Application.Selection.InsertFile method executes...
15
by: Khurram | last post by:
I have a problem while inserting time value in the datetime Field. I want to Insert only time value in this format (08:15:39) into the SQL Date time Field. I tried to many ways, I can extract...
1
by: suslikovich | last post by:
Hi all, I am getting this error when insert values from one table to another in the first table the values are varchar (10). In the second they are datetime. The format of the data is mm/dd/yyyy...
15
by: Jaraba | last post by:
I am working in a project that I need to parse an arrayt an select records based upon the values parsed. I used the functions developed by Knut Stolze in his article 'Parsing Strings'. I am...
2
by: gruvin | last post by:
Hi. I need to insert an image element into text in an iframe in design mode. That part I can do: var sel = oEditor.eFrameDoc.selection; var range = sel.createRange(); range.pasteHTML('<img...
1
by: assgar | last post by:
Hi I need help. I know what I want to accomplish, but I do not know how to do it. WHAT I NEED HELP ACCOMPLISHING: How to do I insert data into a table for a date range of...
2
by: AlexanderDeLarge | last post by:
Hi! I got a problem that's driving me crazy and I'm desperately in need of help. I'll explain my scenario: I'm doing a database driven site for a band, I got these tables for their discography...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
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...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
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: 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

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.