.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

pushing 2columns of one table to another table after filtering(eliminating nulls & inserting only ip

Posted By:      Posted Date: September 16, 2010    Points: 0   Category :ASP.Net
hi thankz in advance,i have 2 tables t1 and t2in t1 i have 4 columns from that i want to insert only 2 columns to another table t2 i only want to send data which is in the form of ip adress like( eliminating nulls and other data.plz suggest me is it possible to write a query or i need to do it programetically.thankz a lot..

View Complete Post

More Related Resource Links

inserting one table data to another after filtering nulls and duplicates

hi i have tbl_ip i want to filter nulls and duplicate to my tbl_ipfilter can u suggest me a stored procedure for this. data of tbl_ip is like below . ip NULL NULL NULL

Fetch Identity column just after inserting a row in table

Hi, Please help me with this question. I have a table and I insert a row into it. How can i select the latest inserted row? Can the 'inserted table' keyword be used outside trigger? ( I mean can we use it in above scenario?? If yes how)   Thanks in advance Tiya

inserting an array of data into a database table

im looking to insert an array of information into a database tableessentially what id like to do is something like this:            objCmd = New OleDb.OleDbCommand("INSERT INTO pluINFO VALUES *", objConn)            For j = 0 To 265                objCmd.Parameters.Add( info(j) )            Next this code gives me a syntax error for the insert statement is there anyway i can set the insert statement that would allow me to add each element of the array(looping through rather than hardcoding several hundred entries) into the table?any input appreciatedThanks

Filtering the Table of Contents Web Part

Hi there, I'm trying to filter the Table of Contents web part so that it only shows a list of sites; excluding the documents, lists, discussions, etc... This is on our projects site, and will be used to show a list of projects. I've scoured the net for quite some time and found some people trying to do the same kind of thing, but couldn't seem to get their custom xsl template to do the trick. I'm by no means an xslt expert, but I believe the answer lies in adding a custom style template that will filter the resultset in the LevelStyle.xsl file? Please help!!!

Filtering pivot table by KPI value

Hi, All ! I've been faced with following problem. I have a kpi that shows whether the dealer has send report in time. This KPI may return two values 1 - in time, -1 -  not in time. I built a simple pivot table in rows of which are dealer name, in column - KPI and in filter - month name. I'd like  to filter dealers by their status, to see only dealers, who haven't send report in time. I tried to filter in the pivot table by value, but without result. How I can doo it ? I thought may be worth  add a some attribute to dealer dimension that contain a KPI value and filter by this attribute ? Thanks in advance !

Get inserted ids when inserting from User Defined Table Type

Imagine this procedure:   CREATE PROCEDURE [dbo].[insertActive] ( -- Add the parameters for the stored procedure here @p_data dbo.activeUpdate readonly) AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. insert into dbo.active (name,stateid) select name,stateid from @p_data END How can I get the ids of the rows that have been inserted?  I tried searching the net and the forums but could not find anything. Thanks for any and all help, Gareth.

Problem Facing While Inserting records into table which os dynamicaly created

Hi,I have created table into database dynamicaly,while inserting records into that dynamic table i faced problem.The name "STD000001" is not permitted in this context. Valid expressions are constants, constant expressions, and (in some contexts) variables. Column names are not permitted. this error occured.I created dynamic table by ,declare @STUDENT_Table varchar(50)set @STUDENT_Table = [dbo].[GetStudentTable](@SchoolID)declare @cmd varchar(5000)Set @cmd = 'Create Table  ' + @STUDENT_Table + '(   [student_id] [varchar](10)NOT NULL,    [school_id] [varchar](50)NULL,    [class1] [varchar](50)NULL,    [division1] [varchar](50)NULL,    [educalis_id] [varchar](16)NULL,    [roll_no] [varchar](10)NULL,    [first_name] [varchar](50)NULL,    [middle_name] [varchar](50)NULL,    [last_name] [varchar](50)NULL,    [gender] [varchar](6)NULL,    [father_name] [varchar](50)NULL,    [mother_name] [varchar](50)NULL,    [father_office_address] [varchar](200)NULL,    [mother_office_address] [varchar](200)NULL,    [home_address] [varchar](200)NULL,    [father_mobile_no] [varchar](10)NULL,    [mother_mobile_no] [varchar](10)NU

Problem when Inserting xml data into a table using OpenXml

Hi, i stuck with a problemam trying to insert data from xml file to sql server.i made query like thisSET NOCOUNT ON DECLARE @hDoc INT EXEC sp_xml_preparedocument @hDoc OUTPUT, '<NewDataSet>  <xs:schema id=''NewDataSet'' xmlns='''' xmlns:xs=''http://www.w3.org/2001/XMLSchema'' xmlns:msdata=''urn:schemas-microsoft-com:xml-msdata''>  <xs:element name=''Job''>     <xs:complexType>      <xs:sequence>        <xs:element name=''BillToNo'' type=''xs:string'' minOccurs=''0'' /> <xs:element name=''Colors'' type=''xs:string'' minOccurs=''0'' /> <xs:element name=''CompanyNo'' type=''xs:string'' minOccurs=''0'' /> <xs:element name=''CsrCode'' type=''xs:string'' minOccurs=''0'' /> <xs:element name=''CsrName'' type=''xs:string'' minOccurs=''0'' /> <xs:element name=''CustomerPoNo'' type=''xs:string'' minOccurs=''0'' /> <xs:element name=''DivisionOriginal'' type=''xs:string'' minOccurs=''0'' /> <xs:element name=''EstimateNo'' type=''xs:string'' minOccurs=''0'' /> <xs:element name=''FinalDeliveryDate'' type=''xs:string'' minOccurs=''0'' /> <xs:element name

inserting data to Users Table in ASPNETDB from Create User Wizard


When a user starts a membership using the Create User wizard supplied by the aspnetdb profile service, I need to add a field to a table in aspnetdb and upon clicking the ContinueButtonClick insert some data.  The field I'll add is "SubscId".  My first question is what table is best for this - Users or Membership?

Secondly, what is the best way to insert new data for this scenario?  code behind?  markup?  Can someone provide basic syntax of insert code in code behind for this scenario?

Inserting and querying data on the same table


I need to implement a logic where in I insert or update a table in a loop.If the record is inserted then I need to update the table.To check this I have given IF NOT EXISTS statement with a query. But IF NOT EXISTS always returns true, so many records are getting inserted and update always fails

How do I resove this problem

getting error while inserting values into table in sql server 2005

i have connected to sql server n my connection string is

conn.ConnectionString =

"data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\subi.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"

But i am not able to insert values into the table..

am getting sqlexception error.... and msg as invalid object name "staff" as staff is my table name.. before this i had some problem with connection then i cleared that problem then after that this problem occured.. plz guide me on this ... i need to complete my project as soon as possible

Inserting 15 minute Interval Data in a table


What is the most efficient way of creating a 15 minute increment table. This table needs to continue to increment with time so its not a static table. While loop? how will that affect the performance, if I have to add dates starting 2005 till today and then basically after that with every hour a value needs to be added.. How can I go about doing that?

I am using SQL 2008

 Thanks -Sarah

filtering table contents shown in datalist


i am using this code to fill my datalist:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim myConnection As SqlConnection
        Dim myCommand As SqlDataAdapter
        myConnection = New SqlConnection("mydb")
        myCommand = New SqlDataAdapter("SELECT * FROM Posts", myConnection)
        Dim ds As DataSet = New DataSet()
        DataList1.DataSource = ds

    End Sub

it works and fills the datalist with the whole table..

when this page opens the address bar is like "www.example.com/threads.aspx?thread ID=123"

i would like the datalist to show all contents in the table with this specific thread ID.. thank you in advance :)

Inserting XML into SQL Server 2008 table



I'm generating an XML file from front end, I'm using 4 Data Transfer Object classes comprising of full details of a Customer like CustomerPersonalInfoDTO.cs, CustomerLoginInfoDTO.cs, CustomerPreviousAddressDTO.cs, CustomerAddressInfoDTO.cs.

Everything is fine and XML is also generated, But the problem is with SQL Server Stored Procedure. I've created a table Customer with 20 columns.

CustomerPersonalInfoDTO.cs holds 10 customer fields and CustomerLoginInfoDTO.cs holds another 10 customer fields (total =20)..

I now need to insert at a time these 20 FIELDS into SQL server Customer Table. My XML Data will look like the below:

<?xml version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" ?> 
- <CustomerDTO>

- <CustomerPersonalInfo>

Inserting value of a textbox into a table


I have a detailsview, and I was wondering how I can insert value from a textbox instead of a boundfield value. I am able assign value to textbox in code behind. Could I please know of a simple way to do this. Thanks

    <asp:DetailsView ID="DetailsView4" DataSourceID="AccessDataSource6" 
             runat="server" Height="250px" Width="625px" AutoGenerateInsertButton="True" 
             AutoGenerateEditButton="True" AutoGenerateDeleteButton="True" 
             AutoGenerateRows="False" DefaultMode="Insert">
                    <asp:BoundField DataField="PartNumber" HeaderText="PartNumber"
                  SortExpression="PartNumber" HeaderStyle-Width="100" /> 
                  <asp:BoundField DataField="QtyOrdered" HeaderText="QtyOrdered"
                  SortExpression="QtyOrdered" /> 
                  <asp:BoundField DataField="Units" HeaderText="Units"
                  SortExpression="Units" /> 
                   <asp:BoundField DataField="QtyReceived" HeaderText="QtyReceived"

Inserting null value into foreign key table with allow null enabled


Hey guys, 

I have 2 table Table A, Table B.

Table A - Parent Table

ID - Uniqueidentifier not null(PK)

Table B -Child Table              

ID - uniqueidentifier null(FK, TableA)

I have a stored procedure to insert data into Table B, but when I tried to insert a null value into column ID of table B, this error came up:

The INSERT statement conflicted with the FOREIGN KEY constraint "FK_tableB_tableA". The conflict occurred in database "database name", table "table A", column 'ID'.

The statement has been terminated.

The insert statement in asp.net is like so:

sqlcommand.parameter.add(New Sqlparameter("ID", Nothing))

I am guessing adding nothing to the null value column is the problem, but i don't know how to fix it... can any1 help me?


The INSERT statement conflicted with the FOREIGN KEY constraint "FK_tableB_tableA". The co

Problem inserting ID value from one SQL table to another using CreateUserWizard



I am designing a registration form where I use CreateUserWizard. I am inserting data into two different tables while use is created. First table is Categories (columns: CustomerID, CatCode) where I insert CatCodes based on selections made in CheckBoxList and second table is Customers (columns: CustomerID, FName, LName, Email) where I register personal details (first, last name, email etc). CustomerID is generated automatically when client registers.

What I want to do is to connect Categories and Customers tables so when client selects CatCodes during registration and selected values are written into the Categories table CatCode column, appropriate CustomerID to be written there as well (in CustomerID column which is a ForeignKey from Cusomers table).

For example: Client is registered, his CustomerID (1001) is created during registration. He also selected three categories (1,2,3) which are written into the Categories table. Now as I have CustomerID in Categories Table as well (ForeignKey from Customer Table CustomerD column), I want generated CustomerID to show up in Categories table so i could later identify what catgories did client 1001 selected.

Category codes (CatCode) is inserted using code behind file in C#:

 protected void CreateUserWizard1_CreatedUser(obje
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend