|
Hello everybody.I am trying to make an application that uses an ODBC driver to connect to a database of a few related tables.
My questions:
a)Can I embed the odbc drivet to the installation programm so that the user wont have to connect to the database?
b)If I create the related tables in the DBMS but without any records(only the pattern of the database) will the user be able to add and delete his/her own through the connected application?
c)Will I be able to create shophisticated queries only by using the MFC Classes(CRecordset) to manipulate the data?
d)Are there any alternatives except the ODBC and DAO?
-- modified at 8:16 Saturday 20th May, 2006
|
|
|
|
|
Hi,
I have some text which has a lot of newlines. I checked the amount of text in an editor. It showed about 2000 characters. When I tried to save this text in an varchar field of 7000 width an error was generated saying about character limit.
Why is this happening? Is it due to the newline characters.
Thanks
-
बुरा जो देखण मै चला, बुरा न िमलया कोय,
जो मन खोजा आपणा तो मुझसे बुरा न कोय।
Translation
|
|
|
|
|
Dinuj Nath wrote: Why is this happening? Is it due to the newline characters.
Each newline character will count as one character, did you include this count in your original 2000.
You may be better off with a ntext column rather than relying on a varchar
Michael
CP Blog [^] Development Blog [^]
|
|
|
|
|
Thanks for the reply. The count is using the count characters util in scite editor and by the way there won't be more than 20 newline chars. I have been forced to use text and it is eating up space. I just can't understand why I just can't store some thousand simple chars in varchar(7000).
|
|
|
|
|
What version of SQL Server? If SQL 2000, is the row size within the page limit?
In MS SQL Server versions prior to 2005, one row's data is limited to fit in one page or an 8kb block. (But the definition of a table can show a total of more than 8kb per row if you have one or more variable length columns.)
|
|
|
|
|
Thanks a lot. Its Sql Server 2000.
|
|
|
|
|
Hi,
Sorry for my ignorance but could someone give me a hand with this SQL query?
I have two tables in an access database. The first hold a list of titles and the second table holds a list of items belonging to these titles.
I need an SQL statement that will retrieve the titles from table a, and in the same row give me the number of items belonging to that title.
EG:
Table A:
Title 1
Title 2
Title 3
etc
Table b:
item: belongsto:
booksworms Title1
bread Title2
Mice Title3
Cheese Title2
Doorwedges Title2
So my statement needs to return the data as follows, although it needs to be based on the records encountered in table a, rather than simply counting/grouping the records in table b.
Title: Count:
Title1 1
Title2 3
Title3 1
etc
Also if anyone can recommend some useful tutorials id be really appreciative.
Thanks!
|
|
|
|
|
You could use something like,
Select a.*, (select count(*) from tableB b Where b.belongsTo = a.title) as WHATEVER
from TableA as a
Farhan Noor Qureshi
if (this == this) thow this;
|
|
|
|
|
Obviously you have simplified the problem, because there is no need for TableA at all in this scenario; all of the information is contained in TableB.
From TableB only:
SELECT belongsto, COUNT(belongsto)
FROM TableB
GROUP BY belongsto
Assuming it needs both tables due to fields we are not seeing:
SELECT a.Title, COUNT(b.belongsto)
FROM TableA a
INNER JOIN TableB b ON a.Title = b.belongsto
GROUP BY a.Title
MS Access might not like the formatting I have used, and may need some parenthesis around some of that (it would work in SQL Server just the way it is formatted).
I like this book:
Guru's Guide to Trasact SQL by Ken Henderson[^]
But it is SQL Server specific (Transact SQL).
|
|
|
|
|
(Scott,)
Thanks for the help. I didnt use the real field names when i posted becuase i wasnt at my development PC. However ive adapted the code and got it part working, as follows:
SELECT a.forumTitle, a.lastPost, a.lastUser, COUNT( b.username) AS count, <br />
FROM tbl_Subforums a<br />
INNER JOIN tbl_Messages b ON a.forumTitle = b.subforum<br />
GROUP BY a.forumTitle, a.lastPost, a.lastUser
However i need to include a count from a third table, i figured it should look something like:
SELECT a.forumTitle, a.lastPost, a.lastUser, COUNT( b.username) AS count, COUNT(c.threadTitle) AS threads<br />
FROM tbl_Subforums a<br />
INNER JOIN tbl_Messages b ON a.forumTitle = b.subforum<br />
INNER JOIN tbl_topics c ON b.subforum = c.subforum<br />
GROUP BY a.forumTitle, a.lastPost, a.lastUser
Unfortunately this doesnt work. Could you please take a look and let me know where i am going wrong. The fields above are all correctly named and the c = b relationships are also correct.
The error i get within access is regarding the Syntaxt, so it would appear my formatting is wrong.
Thanks for any help you can offer!
munklefish
|
|
|
|
|
That looks like it would work in SQL Server, but Access might require paranthesis like:
munklefish wrote: SELECT a.forumTitle, a.lastPost, a.lastUser, COUNT( b.username) AS count, COUNT(c.threadTitle) AS threads
FROM ((tbl_Subforums a
INNER JOIN tbl_Messages b ON a.forumTitle = b.subforum)
INNER JOIN tbl_topics c ON b.subforum = c.subforum)
GROUP BY a.forumTitle, a.lastPost, a.lastUser
Scott
|
|
|
|
|
Thanks Scott!
That did the trick!
Muchos gracias!
munklefish
|
|
|
|
|
Good day everyone,
Please help if you're interested in.
I've got an Access database containing fitness club member profile. I need to make a login session for my webpage. How can I validate user name and password with the ones in database?
I don't have Microsoft SQl Server, so can I do it in VS.Net 2005?
How should I start?
Thanks so much
eric
|
|
|
|
|
|
I am having difficulty setting up my listbox to point to a SQL table (technicians table). I created a dataset that contains the table, but am unable to find enough help sources to create the code to make it work. I have created a Windows form to update a database, which displays the data from a (workorders table). I would like to have one of the fields as a picklist of names to allow the user to change the existing name and re-assign it to another from the list. I know this is basic stuff, but I am new to VB.NET.
Thank you,
LWhite
|
|
|
|
|
How will you take values for an insert statement
To insert the table values some values from one table and some values from open xml this will carried in a Stored Procedure
Help Please
Thanx
-
|
|
|
|
|
I am developing asp.net1.1 application
I have hug number of records in DB( SQLServer ) & want to show in a datagrid
There are thousands of records which need to transfer to client & client can sort & search
What is the best way to handle such type of situation
I am also using Ajax , when I use Ajax to call a function it lock the page until the all data is transfer to client , that’s not good
Did I use xml file to send on client & from xml file show data to client
or if there is any good solution plz....
I will be really thankful
Irfan
|
|
|
|
|
|
Hi,
I have one dataset, that contain one table now how can i retrieve one column in that table can you send me all possible approachments
|
|
|
|
|
if u confirm only one table means
ds.dt[tablename].columnname
-
|
|
|
|
|
Do you really mean 'one column', or do you mean 'one value from a particular row'?
If you really mean 'one column', then:
DataColumn column = dataSet.Tables[string tableName].Columns[columnName]<br />
or<br />
DataColumn column = dataSet.Tables[int tableIndex].Columns[int columnIndex]
If, however, you want the value stored for a particular column in a particular row in a table, then you need to index both the row and the column to get it:
object value = dataSet.Tables[string tableName].Rows[int rowIndex][string columnName (,DataRowVersion rowVersion)]
for example (the first method returns the current value in the described row's value list):
public object GetValueInRow(<br />
DataSet ds, <br />
int tableIndex, <br />
int rowIndex, <br />
string columnName)<br />
{<br />
return GetValueInRow(ds, tableIndex, rowIndex, columnName, DataRowVersion.Current);<br />
}<br />
<br />
public object GetValueInRow(<br />
DataSet ds, <br />
int tableIndex, <br />
int rowIndex, <br />
string columnName, <br />
DataRowVersion rowVersion)<br />
{<br />
return ds.Tables[tableIndex].Rows[rowIndex][columnName, rowVersion]<br />
}
Good luck.
The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’
-- modified at 2:16 Monday 22nd May, 2006
|
|
|
|
|
Good day everyone,
Please help if you're interested in.
I need to make a login session for my webpage. How can I validate user name and password with the ones in database?
How should I start?
Thanks so much
eric
|
|
|
|
|
What type of database are you talking about?
|
|
|
|
|
eric_tran wrote: How should I start?
See this "How To" document on MSDN: How To Use Forms Authentication With SQL Server 2000[^]
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|