|
Thanks for the reply Bob. What I did not make clear in my original post is that HeadOfficeId should relate to another row within the same table.
I have actually, managed to sort it myself, but thanks again for taking the time to help.
Steve Jowett
-------------------------
It is offen dangerous to see someone else's point of view, without proper training. Douglas Adams (Mostly Harmless)
|
|
|
|
|
Thought I was missing something. No worries.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
set markup HTML on
spool index.html
SELECT * FROM pap_in_indexmaster;
spool off
set markup HTML off
I want to execute this script, as it is, so that it does the spool command as it has been scripted to do. I want to execute this script in asp.net....
How Can I do that??
or
any alternative to display the query result in HTML table view in HTML page..??
|
|
|
|
|
The spool command (and I think the set commands too) are specific to the Oracle SQL*Plus tool. If you want to replicate this in ASP.NET then you will have to create a DataReader object and convert the results into HTML within your ASP.Net code.
Regards
Andy
|
|
|
|
|
Hi, I am in the trouber of the error while the project trys to saving the data to child table. The error message
is shown below:
NHibernate.ADOException: could not insert: [ConsoleApplication1.user][SQL: INSERT INTO user (UNAME, NID) VALUES (?, ?)] --->
So confused that why it cannot get values to save. NHibernate I used is version 1.2. The code files are list below, please help me out here.
Thanks in advance.
app.config:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="nhibernate" type="System.Configuration.NameValueSectionHandler, System, Version=1.2.0.4000,Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
</configSections>
<nhibernate>
<add key="hibernate.connection.provider" value="NHibernate.Connection.DriverConnectionProvider"/>
<add key="hibernate.dialect" value="NHibernate.Dialect.MsSql2005Dialect"/>
<add key="hibernate.connection.driver_class" value="NHibernate.Driver.SqlClientDriver"/>
<add key="hibernate.connection.connection_string" value="Server=;initial catalog=;Persist Security Info=True;User ID=;Password="/>
</nhibernate>
</configuration>
user.hbm.xml:
<hibernate-mapping default-cascade="none" xmlns="urn:nhibernate-mapping-2.2">
<class name="ConsoleApplication1.user, ConsoleApplication1" table="user">
<id name="UID" type="System.Int32" column="UID" unsaved-value="0">
<generator class="native" />
</id>
<property name="UNAME" type="System.String" column="UNAME" not-null="false" />
<many-to-one name="Nationality" class="ConsoleApplication1.nationality, ConsoleApplication1" fetch="select" cascade="all">
<column name="NID" not-null="false" />
</many-to-one>
</class>
</hibernate-mapping>
user.hbm.cs:
namespace ConsoleApplication1 {
[System.SerializableAttribute()]
public class Abstractuser {
private int uID;
private string uNAME;
private ConsoleApplication1.nationality nationality;
public virtual int UID {
get {
return this.uID;
}
set {
this.uID = value;
}
}
public virtual string UNAME {
get {
return this.uNAME;
}
set {
this.uNAME = value;
}
}
public virtual ConsoleApplication1.nationality Nationality {
get {
return this.nationality;
}
set {
this.nationality = value;
}
}
}
[System.SerializableAttribute()]
public partial class user : Abstractuser {
}
}
nationality.hbm.xml:
<hibernate-mapping default-cascade="none" xmlns="urn:nhibernate-mapping-2.2">
<class name="ConsoleApplication1.nationality, ConsoleApplication1" table="nationality">
<id name="NID" type="System.Int32" column="NID" unsaved-value="0">
<generator class="native" />
</id>
<property name="NATIONALITY" type="System.String" column="NATIONALITY" not-null="false" />
<bag name="User" inverse="true" lazy="true" cascade="all">
<key>
<column name="NID" not-null="false" />
</key>
<one-to-many class="ConsoleApplication1.user, ConsoleApplication1" />
</bag>
</class>
</hibernate-mapping>
nationality.hbm.cs:
namespace ConsoleApplication1 {
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlIncludeAttribute(typeof(ConsoleApplication1.user))]
[System.Xml.Serialization.SoapIncludeAttribute(typeof(ConsoleApplication1.user))]
public class Abstractnationality {
private int nID;
private string nATIONALITY;
private System.Collections.IList user;
public virtual int NID {
get {
return this.nID;
}
set {
this.nID = value;
}
}
public virtual string NATIONALITY {
get {
return this.nATIONALITY;
}
set {
this.nATIONALITY = value;
}
}
public virtual System.Collections.IList User {
get {
return this.user;
}
set {
this.user = value;
}
}
}
[System.SerializableAttribute()]
public partial class nationality : Abstractnationality {
}
}
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
NHibernate.Cfg.Configuration cfg = new NHibernate.Cfg.Configuration();
cfg.AddAssembly("ConsoleApplication1");
ISessionFactory factory = cfg.BuildSessionFactory();
ISession session = factory.OpenSession();
ITransaction transaction = session.BeginTransaction();
nationality nat = (nationality)session.Get(typeof(nationality), 1);
user u = new user();
u.UNAME = "Pall";
u.Nationality = nat;
nat.User.Add(u);
try
{
if (!session.IsConnected)
{
session.Reconnect();
}
session.Save(u); // Error occured at this line!!
transaction.Commit();
session.Close();
}
catch (Exception e)
{
string s = e.ToString();
}
}
}
}
|
|
|
|
|
I answered this in the other forum. If I had seen that you cross-posted then I wouldntve.
|
|
|
|
|
Hi All
I have a small problem if any budy know please reply me
I have the following sql code
when i will execute it i will get a some data in a single column
Now i want to insert those data into a temp table.But the problem is
@Role_Idv is a column in table [admin].[cm_tb_005].Which i am passing dynamically.
If iam taking only this much
select tb001_id FROM [admin].[cm_tb_005] WHERE '+ @Role_Idv +'='1''
The above code will not work.If iam doing like this
exec('select tb001_id FROM [admin].[cm_tb_005] WHERE '+ @Role_Idv +'=''1''')
It is working.Now i want to store the resulted values in a temp table.So that i can
select the values from temp table for other purposes.
This is the code which iam trying now which is excuting but how can i store the resultant values in a temp table
SET QUOTED_IDENTIFIER ON
declare @res1 nvarchar(500)
declare @TempMenuId nvarchar(800)
declare @Role_Idv varchar(50)
set @Role_Idv='R25'
DECLARE @TempMenuIdTable TABLE(RowIndex INT IDENTITY,Menu_Id INT )
set @res1='select tb001_id FROM [admin].[cm_tb_005] WHERE '+ @Role_Idv +'=''1'''
select @res1
exec(@res1)
Regard's
Veeresh
i want to join this group
|
|
|
|
|
Assuming you are using SQL Server 2005 (probably works on 2000 but not tested) here is a simple example:
create table #temp(employeeid bigint)<br />
<br />
exec('insert into #temp select employeeid from employee')<br />
<br />
select * from #temp<br />
<br />
drop table #temp
Hope this helps
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Hi Sir,
Iam using Sql 2000.Its not working.If there is any solution please rely me.
Regard's
Veeresh
i want to join this group
|
|
|
|
|
I've just had it tested on SQL 2000 and it worked. How is it failing? Whats the error?
Bob
Ashfield Consultants Ltd
|
|
|
|
|
One minut sir.I will check once again.Thanks for replying.
Regard's
Veeresh
i want to join this group
|
|
|
|
|
Hi,
Thanks sir i got it really thanks a lot
Regard's
Veeresh
i want to join this group
|
|
|
|
|
You are welcome
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Hi here is the code in my page
Dim attachment As String = "attachment; filename=Contacts.pdf"
Response.AddHeader("content-disposition", attachment)
Response.Cache.SetCacheability(HttpCacheability.NoCache)
Response.ContentType = "application/pdf"
when i try to open it, it opens Acrobat Reader but the Acrobat Reader gives me an error in the form of a message box with this message "Acrobat could not open 'PressRelease[1].pdf' because it is either not a supported file type or because the file has been corrupted (for example, it was sent as an email attachment and wasn't correctly decoded)."
any idea?
pls....
|
|
|
|
|
sandhya14 wrote: any idea?
Here's an idea. Post your question in the right forum.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
|
sandhya14 wrote: Hi here is the code in my page
Dim attachment As String = "attachment; filename=Contacts.pdf"
Response.AddHeader("content-disposition", attachment)
Response.Cache.SetCacheability(HttpCacheability.NoCache)
Response.ContentType = "application/pdf"
when i try to open it, it opens Acrobat Reader but the Acrobat Reader gives me an error in the form of a message box with this message "Acrobat could not open 'PressRelease[1].pdf' because it is either not a supported file type or because the file has been corrupted (for example, it was sent as an email attachment and wasn't correctly decoded)."
I seem to be missing the select statement here, which seems to suggest that you've picked the wrong forum. Try the ASP.NET one instead.
|
|
|
|
|
I want to execute a stored procedure once per day.(i want to delete some records from a datatable).Is there any direct way do this?
Please help me out.
Thanks.
|
|
|
|
|
You can use SQL Server Agent. This link explains it all:
MSDN SQL Server Agent
Bob
Ashfield Consultants Ltd
|
|
|
|
|
|
Use a SQL job
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Ya. I'll do it.thanks in advanced.
|
|
|
|
|
Is there any way to do scheduling execution of sp using C#.
Any suggestions...
thanks
|
|
|
|
|
How do I add a column to multiple table when some of the table already have the column name I wish to add.
Thanks in advance,
Michael
|
|
|
|
|
Simple. You can't. If the column name exists in the table then you can't add it again, it wouldn't make sense.
Bob
Ashfield Consultants Ltd
|
|
|
|