|
Your user name is the smae as the account name with which you login to your machine with, not necessary your full name.
Also, when posting code here make sure to format it by using pre tags. I know the language. I've read a book. - _Madmatt
|
|
|
|
|
What, pray tell, are pre tags?
Do I use them on every line of code or just at the start and at the end of code?
|
|
|
|
|
|
mhh112 wrote: Exception Details: System.Data.SqlClient.SqlException: Cannot open user default database. Login failed.
The error really tells you the problem - Cannot open user default database which means your user is not set up correctly in SQL Server. Go in and see what your default database is set to, or change your connection string to specify the database you want to use.Bob
Ashfield Consultants Ltd
|
|
|
|
|
Ok, here is a silly one.
I have a ms access database that i want to manipulate through a datagridview in my VB .net app.
I have defined the appropriate field in the database as DATE/TIME, because i will make date filtering on the records through sql in my app.
Now when i add any record through my app, i always get a date format like 17/2/2010 0:00:00 in the datagridview, obiously because this is the format of the access database which is databound to the grid.
I DO NOT want the time part.
Is this doable or i am stuck with it ?
Thanks
|
|
|
|
|
Johnkokk wrote: i always get a date format like 17/2/2010 0:00:00 in the datagridview, obiously because this is the format of the access database which is databound to the grid.
Go to the offending table and open it in the design-view. Click on the DateTime-field and go to the properties. There's a Format property that controls how the data of this particular column is formatted.I are Troll
|
|
|
|
|
I would assign the responsibilities to the right parties: let the database hold the data and not worry about formatting, and let the application take care of the formatting; in this case, tell the DGV what format is to be used.Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.
|
|
|
|
|
+5, and goodmorning;
You're right. The native grid in Access 2007 doesn't support that, but if it's a VB.NET application than he's using a DataGridView - and not a grid on a native Access-form I are Troll
|
|
|
|
|
Good morning Sir to you too.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.
|
|
|
|
|
I've already tried setting the formating in the database field.
It doesn't work
|
|
|
|
|
you can solve it by two ways.
1. Using the date column datatype's format property in Access database.(various formats like General Date, Long Date, Medium Date, Short Date, Long Time, Medium Time, Short Time)
2. using the DataFormatString property of bound column in gridview. (examples: DataFormatString="{0:MM-dd-yyyy}", DataFormatString="{0:MMM dd, yyyy}", DataFormatString="{0:ddd MM, yyyy}", etc )
|
|
|
|
|
<b>2. using the DataFormatString property of bound column in gridview. (examples: DataFormatString="{0:MM-dd-yyyy}", DataFormatString="{0:MMM dd, yyyy}", DataFormatString="{0:ddd MM, yyyy}", etc )</b>
That worked, thanks
|
|
|
|
|
Hi,
you can set the formatting specification for each individual column of a DataGridView. Here is a C# example:
dgv.Columns[1].DefaultCellStyle.Format="dd MMM yyyy";
which works fine as long as the field bound to that column is a DateTime (and not a string!)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.
|
|
|
|
|
Hi guys,
i'm kinda new in using MSSQL. I'm using MSSQL Server 2005. I've created the primary key on a field that auto generates. However, i need to disallow the same name inputed again. I think i might have to write a t-sql statement on the table. But i really don't know how to go about it.
Pls help. How can i achieve this?He who goes for revenge must first dig two graves.
|
|
|
|
|
Creamboy wrote: However, i need to disallow the same name inputed again.
That would be a Unique Constraint , somewhat similar to this example;
ALTER TABLE [MyTable]
ADD CONSTRAINT [UniqueConstraintName]
UNIQUE (ColumnValue) I are Troll
|
|
|
|
|
Hello everyone,
I have a MS SQL Server 2005 Express Edition and I want to restrict Login access to the database to only one specific domain account. How can I do this any ideas? because when I went to try and create a windows login and specified the domain account that I want it worked ok, but when then I tried to Login into the database again with a different domain account to test it still let me in. Is there some particular setting that I don't know about that anyone can help me with?
Thank you very much.
|
|
|
|
|
How to retrieve data from two different database with single query
|
|
|
|
|
Put the database in teh from clause:
select * from [database].[owner].[tablename]
select * from nortwind.dbo.customers
You can ommit the owner if you want:
select * from northwind..customers Wout Louwers
|
|
|
|
|
select t1.*,t2.* from database1name.dbo.tablename as t1
join database2name.dbo.tablename as t2
on t1.columnname=t2.columnname
where condition (if any)
|
|
|
|
|
The responses you have assume that the databases are on the same server, in which case database.owner.tablename will work. If they are on different servers you have a problem, you need to set up linked servers, something I hate doing as the server is then hard coded into the query. Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Good Day All
i have a Simple Query
select id,NodeID,Description,refParent from #nodes2
order by id ,refParent,description
this shows the following data
ID NODEID DESCRIPTION REFPARENT
======================================================================
0 149 Compulsory NULL
1 155 One of 0
2 156 GunningM 0
3 157 JonesJ 1
4 158 One of 0
5 159 D1127 4
if you can look in this table the Records ID 5 and 5 are fine but this record but
2 156 GunningM 0
is supposed to be under its parent which is the one with ID 0, so i want to sort it so that it can have the following results
ID NODEID DESCRIPTION REFPARENT
======================================================================
0 149 Compulsory NULL
2 156 GunningM 0
1 155 One of 0
3 157 JonesJ 1
4 158 One of 0
5 159 D1127 4
Thank youVuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Your question makes no sense whatsoever.
Why should record ID 2 come above record id 1? There is nothing there that could possibly identify the fact that it should do.
And besides, your order by gives prescendence to the ID column:
order by id ,refParent,description
So even if there was something (such as an ordinal column) it would be ignored.
If there is a fake order that children must come in, then you will need to add a column for this and order by that column.
|
|
|
|
|
The record
2 156 GunningM 0
is a Child of the Parent 0 and it has no Children. So there are other records that have REFPARENT of 0 but they have children. So if the record has no child it must come close to its parent.Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Your ordering is wrong, you are ordering by id first so your results are in the correct order. To get the results you want, you will need to change the "order by" settings; probably to refParent first, then by id descending. txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
Can you please explain the criteria that cause the records with ID = 2 and ID = 1 to sort that way? Is it because there is no reference to that ID? Thanks. Chris Meech
I am Canadian. [heard in a local bar]
In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]
|
|
|
|