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

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

Generating a specific format primary Key id

Posted By:      Posted Date: October 07, 2010    Points: 0   Category :Sql Server

I have the following  tables Students & StudentsSubjectInfo
Students table has  the Following Fields
ID                         Name
1                            ABC
2                            XYZ

now when inserting the details in StudentsSubjectInfo table the SID should be as follows :
SID                         ID                    SubjectDetails
1-0001-2010              1                      Subject 1
1-0002-2010              1         

View Complete Post

More Related Resource Links

Xml generating in fixed tag format

Hi All!   I have generated xml file from relational database now I want to display all the elements of one category in 1 category tag and I have several categories.   Regards, Mahavir Jadhav  

Usual solutions not the problem for Format of the initialization string does not conform to specific

I know that there are normally two causes/solutions for the "Format of the initialization string does not conform to specification starting at index 0" error message.  The two normal suggestions are a problem with the connection string or it is surrounded by quotes in Dimming the connection. I get the message while running in debug (though it is pulling the selected row ID value correctly).However neither of those are the case in my file.  I know the connection string is configured correctly because it works in the rest of the page.  Further I don't have quotes in the Dim connection part.  Relevant bits of code below.Imports System.Web.UI.WebControls Imports System.Web.UI.WebControls.ImageButton Imports System.Web.UI.WebControls.DataControlField Imports System.Data Imports System.Data.SqlClient Imports System.Configuration Imports System.Object Imports System.DirectoryServices Partial Class Default2 Inherits System.Web.UI.Page 'Private auth As authenticate 'Private dt As DataTable 'Private programs As DataRow() Private dbConnection As String = "KMConnectionString" . . . Sub btnPlay(ByVal sender As Object, ByVal e As EventArgs) 'grab video ID Dim videoID = GridView1.SelectedValue.ToString() Response.Write(videoID) Dim con As New SqlConnection(dbConnection)

Unable to load the package as XML because of package does not have a valid XML format. A specific XM


When I execute a DTSX (which was developed in BIDS 2005) in through

command prompt (on a server which only has SQL Server 2005 and SSIS 2005) using dtexec.exe against /File paramger, it was working perfectly fine.

However, I get the following error message after executing on a server which has SQL Server 2005 and SSIS 2005 & 2008.  Is it possible to execute a DTSX, which was developed in BIDS 2005, on a server that has both SSIS 2005 & 2008?  Please advise.  I often get the following error message in such case.  Thanks!


    "c:\Program Files\Microsoft SQL Server\90\DTS\Binn\dtexec" /FILE \\server123\DATA\AMP.dtsx /DECRYPT PassWordd > \\server123\DATA\output.txt

Error MSG:

     Microsoft (R) SQL Server Execute Package Utility
Version 9.00.4035.00 for 32-bit
Copyright (C) Microsoft Corp 1984-2005. All rights reserved.

Started:  8:40:30 PM
Error: 2010-09-26 20:40:30.84
   Code: 0xC0011007
   Source: {0C157B60-C291-43ED-84A9-23F0DC7D5862}
   Description: Unable to load the package as XML because of package does not have a valid XML format. A specific XML parser error will be posted.
End Error
Error: 2010-09-26 20:40:30.84

Save value in double value in specific format(00.00)


How can i assign a value in a double variable which would be in format 00.00

I want to do it while declaring or assigning the value.

i.e if should contain two digits and should be rounded off to two digits and 0 should be added if it has single digit.....


2 should be saved and later used as 02.00

27.7777777 -> 27.77 or 27.78;

Surrogate vs Natural Primary Keys - Data Modeling Mistake 2 of 10

In case you're new to the series I've compiled a list of ten data modeling mistakes that I see over and over that I'm tackling one by one. I'll be speaking about these topics at the upcoming IASA conference in October, so I'm hoping to generate some discussion to at least confirm I have well founded arguments.

The last post in this series Referential Integrity was probably less controversial than this one. After all, who can argue against enforcing referential integrity? But as obvious as surrogate keys may be to some, there is a good deal of diversity of opinion as evidenced by the fact that people continue to not use them.

How To Set a Date Format In GridView Using ASP.NET 2.0

A very common desire is to set a column of a gridview to display just the month, day and year of a DateTime type. The problem is the by default, the HtmlEncode property of the boundfield attribute (
The problem is that if this field is enabled, you can not pass format information to the boundfield control. That is, if you try the following code, you will not get the desired result.

How to format and update GridView and DataGrid rows using JQuery

The behavior described in this question is as expected. When you set text of a cell in grid, it directly affects HTML that is going to be rendered. When you set text value of a cell, it means that you are setting innerText of the cell. The column that GridView creates for command fields (Edit, Delete and Select) are a (anchor) or button elements. So you can see what will happen if you set text value in that cell. It will wipe out those link or button controls and replace them with simple text string.

How to format datetime & date with century?

Execute the following Microsoft SQL Server T-SQL datetime, date and time formatting scripts in Management Studio Query Editor to demonstrate the usage of the multitude of temporal data formats available and the application of date / datetime functions.


Program for Format Conversion of An Image

.NET provides extensive support for image conversion. Any image can be processed from one format to another. Most common formats to which .NET have support for are .BMP, .EMF, .GIF, .ICO, .JPG, .PNG, .TIF and .WMF.

Get pixel format, raw format, property id list and property items image in VB.net - C#.net.

n this simple article you will learn that how we can get pixel format, raw format, property id list and property items image in VB and C#.net.

Get Pixel Format:

Image consists of pixels to get the format of the pixel we have a property named pixel format. This property returns an enumeration of pixel format. This enumeration tells the pixel format.

To demonstrate make a window application. Drag one button and a picture box on form.

Now write the following code on Button click event:

Format Generic List Bound to Gridview


I have a generic list of a custom type. The custom type has a string and double.

I'm binding the list to a gridview and it outputs everything fine.

I'm trying to format the double column into a currency format. It is in a template field as I'm calculating a running total. I pass the value to a function that returns a double and adds the current value to a running total which I will show in the footer.

The format is not changing to currency as expected when using String.Format("{0:c}", GetTotal(Convert.ToDouble(Eval("Amount"))))

Any ideas on what might be going on and how to fix this?


Button specific code


I have 2 submit buttons on my page. Right now, the only way to run the code behind with razor is to to If(IsPost). Since I have 2 buttons, how would I destinguish between the two in post? Is there a way to request a button that sent a post request?  

Getting list of users reporting from specific Manager from Active Directory


Dear All,

I am have requirement like displaying all the user information reporting to specific manager from Active Directory.

Please help me regarding this.



Export Dataset to excel sheet in a required format?



I know how to export a grid view to excel.

But here i have a Dataset which consists of data like below and also it need to display in a required format like below.

pno psubno pstate pdetailid pdetails

 12    1          CA         1           cbsdjcbdjc     

12     1          CA          2        cndcnjdcjcj

12     2           VA         4          xcndwkfcgygry

13     1            AL        1           ncdcnjdcndj

My excel sheet  should like this.

pid       pstate     

 12/1      CA             &nb

Create web site specific to mobile device, how to detect?



I have a website that is written in .Net 2.0 which uses all the nice rich functionality of the web (Ajax, javascript etc..).  However I have noticed that the site does not display very well on mobile devices. 

So therefore I would like to create a more streamlined version of my site that is better tailored to these devices.  However how do detect that the user has come to the site via a mobile device and how can i redirect them to my tailored page

Many thanks in advance

Test Run: Generating Graphs with WPF


A common software-development task is generating a graph from a set of test-related data. But if you're doing it by hand and the underlying data changes frequently, this particular task can become quite tedious. James McCaffrey shows you how to automate the process using Windows Presentation Foundation technology.

James McCaffrey

MSDN Magazine June 2010

Patterns in Practice: Internal Domain Specific Languages


Jeremy Miller explains how internal Domain Specific Languages can help you craft code that is easier to read and write. His bag of tricks to improve your programming includes extension methods, fluent interfaces, object extensions and use of the semantic model.

Jeremy Miller

MSDN Magazine January 2010

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