|
use #12-12-2004# , it might help to insert date
|
|
|
|
|
Guys, any free OLAP grid for ASP.NET apps that you'd recommend? (Yes, Crystal Reports Designer comes with Visual Studio.NET - but not OLAP grid)
Norman Fung
|
|
|
|
|
Hi, just downloaded NHibernate and playing with it. I ran into this problem when I tried to persists my very first object to database:
"NHibernate.ADOException: Could Not Save Object --> No Persister for SimpleNHibernate.User"
Here's code fragment:
<br />
namespace SimpleNHibernate<br />
{<br />
<br />
class Tester<br />
{<br />
<br />
[STAThread]<br />
static void Main(string[] args)<br />
{<br />
User usr;<br />
<br />
Configuration config = new Configuration();<br />
ISessionFactory factory = config.BuildSessionFactory();<br />
ISession session = factory.OpenSession();<br />
ITransaction transaction = session.BeginTransaction();<br />
<br />
try {<br />
config.AddClass(typeof(SimpleNHibernate.User));<br />
<br />
for(int i=0; i<50; i++) {<br />
usr = new User();<br />
usr.Id="user" +i;<br />
usr.UserName = "user" +i;<br />
usr.Password = "testing";<br />
usr.EmailAddress = "testing@testing.com";<br />
usr.LastLogon = DateTime.Now;<br />
<br />
session.Save(usr);<br />
session.Flush();<br />
<br />
Console.WriteLine(i);<br />
}<br />
<br />
transaction.Commit();<br />
<br />
} catch(Exception ex) {<br />
transaction.Rollback();<br />
Console.WriteLine(ex);<br />
Console.WriteLine(ex.Message);<br />
} finally {<br />
if (session!=null) {<br />
try {<br />
session.Close();<br />
} catch(Exception ignored) {<br />
}<br />
}<br />
}<br />
<br />
return;<br />
}<br />
}<br />
}
Seems like everyone is suspecting that the problem has to do with mapping file [^]... But, the error happens when:
session.Save(usr);
Yes yes, I have embedded my mapping file User.hbm.xml with the assembly so ...
I have also tried to explicitly specify mapping file by adding to nhibernate configuration section of my application config file:
add key="mapping file" value="User.hbm.xml" (bracket ommited..)
Not much luck...
btw, this is a sample (with a bit of modification...) from The Official QuickStart Guide
Thanks in advance.
Norman Fung
Norman Fung
|
|
|
|
|
hi,
i just want retrive schema of Sql Server 2000 database,and using ADOX for that. i got an error when try to iterate through KEYS Collection :
com error :-
datasource null etc..
any alternate method to get KEYS of a Table USING ADOX
by
baijumax
|
|
|
|
|
hi,
i was going to use the ibuyspy example of registering a new user but for some reason my version of the code will let duplicate emails into the database?? im not sure why??
Any way I wondered if any of you guys could point me in the right direction regarding registering a new user page? My login page works fine ...but this register page is giving me a headache!!
Thanks in advance!
Jetset
|
|
|
|
|
jetset32 wrote:
my version of the code will let duplicate emails into the database?? im not sure why??
Add a unique constraint to the database column. Then if you attempt an INSERT or UPDATE with a duplicate email then the operation will fail and you can catch the SqlException
Alternatively, you can write a stored procedure that does a check first and returns a success code back if the check passed and the record was INSERTed or UPDATEed.
jetset32 wrote:
but this register page is giving me a headache!!
For details on ASP.NET see the ASP.NET forum. Unless the thing giving you the headache is database related
Do you want to know more?
WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and Forums
|
|
|
|
|
My application captures individual data frames from a measuring device and stores them in an Access database via ODBC.
It also has an option to record video (actually web cam) along with the data.
My original thought would be to record the video file as as seperate file, and when the capture has finished, copy the whole file into the database as a longbinary field.
Another way would be to store each video frame along with the data frame that it corresponds to into one database record.
Any suggestions as to which way is better (or other ideas)
Neil
|
|
|
|
|
soundman32 wrote:
to record the video file as as seperate file, and when the capture has finished, copy the whole file into the database as a longbinary field.
What about recording the video as a separate file, and at the end, store the path to that video file in the database?
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
I have a datalist and it works fine with the edit up to the point I get the text boxes and can make the changes. then if I click update my two "message.Text" printers show first the Key correctly, and then the other one shows the original first name, not the name which I changed it to. there are no errors or exceptions. I had done the database command two different ways, one is commented out. I'm not sure how far off I am from having this work. Any assistance would be very welcome.
public void Edit_User(object sender, DataListCommandEventArgs e)<br />
{<br />
userList.EditItemIndex = e.Item.ItemIndex;<br />
userList.DataBind();<br />
}<br />
<br />
public void Update_User(object sender, DataListCommandEventArgs e)<br />
{<br />
string txtCustFirstNameEdit = ((TextBox)e.Item.FindControl("txtUserFirstNameEdit")).Text;<br />
string UserKey = userList.DataKeys[e.Item.ItemIndex].ToString();<br />
<br />
message.Text = UserKey;<br />
message1.Text = txtCustFirstNameEdit;<br />
<br />
OleDbConnection userListConnection = new OleDbConnection(@.....");<br />
<br />
//StringBuilder custUpdateBuild = new StringBuilder();<br />
//custUpdateBuild.Append("UPDATE custInfo SET custFirstName = ('");<br />
//custUpdateBuild.Append(txtCustFirstNameEdit);<br />
//custUpdateBuild.Append("') WHERE ID= ('");<br />
//custUpdateBuild.Append(UserKey);<br />
//custUpdateBuild.Append("')");<br />
//string oleUpdateString = custUpdateBuild.ToString();<br />
<br />
string oleUpdateString = "UPDATE custinfo SET custFirstName = "+"'"+txtCustFirstNameEdit+"'";<br />
oleUpdateString += " WHERE ID = " + UserKey;<br />
OleDbDataAdapter userUpdateAdapter = new OleDbDataAdapter();<br />
userUpdateAdapter.UpdateCommand = new OleDbCommand(oleUpdateString, userListConnection);<br />
userListConnection.Open();<br />
userUpdateAdapter.Update(userListDataSet, "custInfo");<br />
userListConnection.Close();<br />
<br />
userList.EditItemIndex = -1;<br />
userList.DataBind();<br />
<br />
<br />
}
|
|
|
|
|
I need help with a problem, I have a field that contains 28 charecters, and I need to truncate the first 12 so that when my view executes it only shows the last 16.
I am running SQL2000 Server and am accessing my data from a ASP/JS Dataform build in Dreamweaver!
Any suggestions?
David
You are only as good as your last project.
|
|
|
|
|
Use SQL SUBSTRING function. E.g.
SELECT SUBSTRING(fieldName, 13, 15) FROM tableName
You can read more about SUBSTRING in SQL Books Online.
|
|
|
|
|
thanks, worked like a charm!
May your Karma grow with your speed and knowledge!
You are only as good as your last project.
|
|
|
|
|
hi
i want to have a function that gets
the SqlConnection and returns DataTableCollection.
i can not find anything on books.
what should i do plz?
|
|
|
|
|
Please elaborate on what you are trying to do. "a function that gets
the SqlConnection and returns DataTableCollection" doesn't make any sense at all.
|
|
|
|
|
function is a c# method that its parameter is a valuable
SqlConnection object for connecting to database and returns tables of database .
and how i can get sqldatatype of columns in this way?
thanks.
|
|
|
|
|
Make use of:
Select * from sysobjects (where type=u if you want user tables only)
select a.[name], b.[name] from syscolumns a, systypes b where a.[id] in(select id from sysobjects) and b.xtype=a.xtype
hope this will help you.
|
|
|
|
|
iam a beginner in SQL.
my request is , i have a table and there are many duplicate records in a table . i just want to remove all the duplicates records except one.
i need this query. pls help me
|
|
|
|
|
|
Colin's answer will filter out the duplicates when you do your query, but your post says you want to "remove" the duplicate records. If you want to actually remove duplicate records from the database, you will need to more than query the database, you will have to use a program to do that.
|
|
|
|
|
Or you can create a table and inserts the records from select distinct.
<italic>Work hard and a bit of luck is the key to success. You don`t need to be genius, to be rich.
|
|
|
|
|
if you want to show just non-duplicate rows than
select * from TableName where Field1+Field2+Field3 not in(select Field1+Field2+Field3 from a group by Field1+Field2+Field3 having count(Field1+Field2+Field3)>1)
make sure that Field1, Field2 and Field3 are all non number type (or otherwise convert to varchar).
hope this will help.
|
|
|
|
|
Or event better (for showing NON-duplicate rows):
SELECT columnlist
FROM tablename
GROUP BY columnlist
HAVING COUNT(*) = 1 (Fill inn the columnlist with all columns of that table...)
Have a look at my latest article about Object Prevalence with Bamboo Prevalence.
|
|
|
|
|
I need to retrieve the primary key column name for the given table.
The data given is: Table name
The data to be extracted is: primary key column name
Can anyone help me out in this
|
|
|
|
|
You don't specify which database product you are using so I shall assume it is SQL Server 2000.
SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE AS ccu
INNER JOIN INFORMATION_SCHEMA.TABLE_CONSTRAINTS AS tc
ON tc.CONSTRAINT_NAME = ccu.CONSTRAINT_NAME
WHERE CONSTRAINT_TYPE='PRIMARY KEY'
AND tc.TABLE_NAME = 'MyTable'
This assumes also that there is only one schema (dbo) or that there are no tables with the same name in different schemas.
Does this help?
Do you want to know more?
WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and Forums
|
|
|
|
|
Hi there
Thank you very much. Iam using Sybase I have found the solution this command dont work in sybase, it was done in different way.
|
|
|
|