|
If you are logging into SQL Server with the ASPNET account you need to make sure that the login exists :
sp_helplogins
Verify that the ASPNET user account is created in the Contacts database
sp_helpuser
And that the uid of the ASPNET login is the same uid as the ASPNET user. (logins are to a server, users are to a database)
Then check the permission that the ASPNET user has against the table in question:
sp_helprotect
If you don't have sufficient permission, use the GRANT SELECT ON <object> TO <user>.
|
|
|
|
|
Is this possible... to determine the datatype of the column, in ACCESS database... like text/date/memo etc...
I was born intelligent Education ruined me!.
|
|
|
|
|
|
Mine is MS Access database
I was born intelligent Education ruined me!.
|
|
|
|
|
|
you could use ADOX which allows you to access an databases data definition language. I have some code which you could use, i'll post when i get into work.
"We don't understand the software, and sometimes we don't understand the hardware, but we can *see* the blinking lights!"
|
|
|
|
|
I use the .type to extrract the type of the field in the database. It works fine....
Thanks to.. the UTE[^].. where I got this idea
I was born intelligent Education ruined me!.
|
|
|
|
|
I have a query which returns a recordset for a statement which is displayed in ASP. It works very nicely - except for one thing. I suddenly noticed that although my
if rstDisplay.BOF or rstDisplay.EOF then - display error msg
else - display statement
works really well unless the firm has never had a single transaction (iow. if it has had transactions, just not within the current requested dates). The page then errors. After investigation I have found that it is because of fields sitting in the background which have been returned (eg. the firm name does exist in one of the tables, so that field is hiding in the background somewhere)
so the following returns:
Response.Write "state: " & rstDisplay.State -Displays "1"
Response.Write "count: " & rstDisplay.Fields.count -Displays "18"
so now I want to play with joins in query analyser. I am using @@rowcount to see how many rows are displayed, but don't know what to use to show the fields (like asp .fields.count). Can anyone enlighten me please?
Thanks
I knew it would end badly when I first met Chris in a Canberra alleyway and he said 'try some-it won't hurt you'... -Christian Graus on Code Project outages
His thoughts tumbled in his head, making and breaking alliances like underpants in a tumble dryer.
It hurt the way your tongue hurts after you accidentally staple it to he wall-Shaun Wilde
|
|
|
|
|
Megan,
If you are using Query Analyzer, it should show you the number of rows returned in the lower right hand corner without having to use rowcount. Under the results tab, there should be a boxes that show the following:
General Message, Server Name, User Name, Database, Execution Time, Number of Rows, and Caret Position
Additionally, if you want to see the @@Rowcount Variable in Query Analyzer, you mut declare a variable, set the variable = @@Rowcount and then print the variable.
<br />
DECLARE @myRows Int<br />
Select * from myTable<br />
Set @myRows = @@RowCount<br />
PRINT @myRows<br />
Hope this helps.
Jeremy
Jeremy Oldham
|
|
|
|
|
Hi,
Thanks - that's exactly the problem. The rowcount returned is 0. But if I click on the messages tab there appears to be an empty row there (I can go up to an empty line with my arrow keys). There is actually no row returned that meets my criteria, but info does exist that does meet some of the criteria, but not all (perhaps I should use a join instead of "and"?) and so the recordset is returned empty.
It's all very odd, but I'm probably just doing something silly.
Thanks again
I knew it would end badly when I first met Chris in a Canberra alleyway and he said 'try some-it won't hurt you'... -Christian Graus on Code Project outages
His thoughts tumbled in his head, making and breaking alliances like underpants in a tumble dryer.
It hurt the way your tongue hurts after you accidentally staple it to he wall-Shaun Wilde
|
|
|
|
|
Megan,
If you can show me your SQL, sample data in the table, and the result you expect, maybe I can help.
Let me know.
Jeremy
Jeremy Oldham
|
|
|
|
|
Hi,
Thanks for all the help - I've fixed the problem.
I knew it would end badly when I first met Chris in a Canberra alleyway and he said 'try some-it won't hurt you'... -Christian Graus on Code Project outages
His thoughts tumbled in his head, making and breaking alliances like underpants in a tumble dryer.
It hurt the way your tongue hurts after you accidentally staple it to he wall-Shaun Wilde
|
|
|
|
|
Megan,
When you run a query in QA here's what happens.
SQL Server sends back as part of the data stream, a header, data rows and the footer. The header contains the column information as to the number of columns, column names, and data types. The next section in the data stream is the actual row data and the footer contains the rowcount information.
So if you issued a query "SELECT * FROM authors WHERE 1=0" you would get a header with the column descriptions, no row data, and a footer that says "0 rows affected".
So when you are running your query, sql server is building the datastream and returning it to you but due to your join there are not any qualifying records, so you don't see any data.
|
|
|
|
|
It sounds like you want to return the firm regardless of whether they have any orders or not. if this is the case then you need to do an outer join between the firm table and the order table so that you guarantee yourself that you always get the firm data, but then all the order data would be null if there aren't any matches.
SELECT f.*, o.*
FROM firm f
LEFT OUTER JOIN order o on (
f.firm_id = o.firm_id
)
But if you post a sample of the query you're trying to run and the results that you want, I'll be better able to give you a solution.
You don't have to post the full query, just enough to get the general principle.
|
|
|
|
|
I use access database. I use ASP page to communicate with my access database. Is there any way to find the list of 'tables' in my access database from ASP or using jscript??
Thanks
I was born intelligent Education ruined me!.
|
|
|
|
|
Sure, using ADODB you can.
Have a look at the MSysObjects[^] table in Access.
It is very similar to the Sysobjects ,et al tables in SQL.
HTH
Cheers,
Simon
"The day I swan around in expensive suits is the day I hope someone puts a bullet in my head.", Chris Carter.
my svg article
|
|
|
|
|
Let me check.... Thanks
I was born intelligent Education ruined me!.
|
|
|
|
|
|
I was born intelligent Education ruined me!.
|
|
|
|
|
I have created a simple C# ASP.NET app, that uses a database(SQL) which is programed only to check users againsit a the database entry. when I try to run the program, I get to the server page, and than when I enter the user password, than I press invoke. however I just get a "The page can not be displayed - There is a problem with the page you are trying to reach and it cannot be displayed." error message. To my knowledge I have programmed this correctly, but can't seem to get pass this error. The below code is all I'm doing:
[WebService(Name="TestWebServer Web Service", Description="Test SQL Database")]
public class Service1 : System.Web.Services.WebService
{
const string connStr="server=SILICON;uid=sa;pwd=;database=MytestDatabase";
[WebMethod(Description="Method to Authenticate Users")]
public bool Authenticate(string username, string password)
{
SqlConnection dbConn = new SqlConnection(connStr);
string sqlStr = "SELECT Password from PM_USERS where UserName = '" + username + "';";
dbConn.Open();
SqlCommand dbCommand = new SqlCommand(sqlStr,dbConn);
SqlDataReader dbReader = dbCommand.ExecuteReader();
bool returnBool;
if (dbReader.Read())
{
if (dbReader[0].ToString()==password)
{
returnBool = true;
}
else
{
returnBool = false;
}
}
else
{
returnBool=false;
}
dbReader.Close();
dbConn.Close();
return returnBool;
}
that's pretty much it!
|
|
|
|
|
cross posting!!
I was born intelligent Education ruined me!.
|
|
|
|
|
Here is my problem.
My code reveives a ADO recordset. I have no control over the cursor types etc on this recordset. I need to copy this recordset to another Recordset. The new recordset is not connected to any database or any source.
Then I am to do stuff to the data in the new recordset, delete some of the rows and then pass the recordset on to a module that expects a Recordset as input.
How do I create a recordset, and then copy data from an existing recordset to this one. Each time I try some code it blows up. Is it even possible?
I tried something like:
while not eof
localRecordset.AddNew //It blows up here if the recordset is not open.
If I do recordset.Open //Then I do not know what parameters to open it with
Thanks
|
|
|
|
|
Hi..
Use the method Clone of the recordset object to copy a recordset into another..
Set rs2 = rs1.Clone (LockType)
|
|
|
|
|
My users will be uploading a comma-delimited text file that I need to check for format (I do not have control over the file they create) and consistency with my existing data. If the file passes the checks I will import the file into the database otherwise, I'll tell them to go back, fix the file and try again.
I can upload the file, perform the checks (once it's in a table) and report the errors. Here's the question.
How do I import a tex file of an unknown format (what I need to check)
Since this is web-based how do I accomodate multiple-users (i.e. I can't import into one temp file 'cause users will step all over each other)
Thanks
David
|
|
|
|
|
You might want to use DTS (distributed transaction server) to do a bulk insert from your file. You can even set DTS to run at a later point in time too. Check the SQL Server documentation, I don't remember exactly how DTS works, but there is a VBScript object for it.
|
|
|
|