|
J Cardinal wrote:
I think that the drag and drop is an excellent way for a beginner to learn what is required to get the task accomplished, but then most would quickly move beyond that if they are programming more than a very simple application.
Goes for most visual designers). I always like to learn the ropes by doing things with the designers and then looking at the code they generate. That gives you a beginning foundation, but then of course you'll always need to go far beyond that.
"Do unto others as you would have them do unto you." - Jesus
"An eye for an eye only makes the whole world blind." - Mahatma Gandhi
|
|
|
|
|
I want to allow access to a directory by comparing a value in a table with the "HTTP_REFERER" Example: If I want to allow access via a hyperlink from any page on this site, then my entry in the table would be "thecodeproject.com" and my WHERE statement is checking to see if "thecodeproject.com" is contained in the "HTTP_REFERER"
I'm connecting to the database when I use "=" and I enter a value in the table that matches "HTTP_REFERER" exactly.
What is wrong with the sQuery line? I use query analyzer all day long but this is my first attempt to use sql along with ASP.
referer=lcase(request.servervariables("HTTP_REFERER"))
sQuery = "SELECT * FROM pbs WHERE orgin like " & "'" & referer & "'"
Also, what would I need to place on each page that would continue to allow the linked visitor to navigate as long as they are allow permission initially. That is if you type the url in the address bar or link from an unauthorized site, then you would get redirected to a "you can't get here from there" page.
|
|
|
|
|
You didn't say what the problem was, (i.e. are you getting an error on that query etc), so I'm guessing you mean that the query is bad and you don't know why, or it's simply not matching an hits when it should.
Run your program, set a breakpoint on the line that sets sQuery, put it in the watch window and copy the query text exact into a view in your SQL database or query analyser and confirm that it will work. Most likely you might need to either add a wildcard character on one or both sides or it's your lower case (lcase) that is mangling the original data so that it no longer matches.
For the second part, it's off topic for this forum, but there is an excellent article on forms based authentication on this site and it works very well and is easy to implement.
"Things are more like they are now than they ever were before."
-- Dwight Eisenhower
|
|
|
|
|
- You haven't specified any wildcards in your
LIKE statement, so it's the same as an equality test; - Since you want to test if the
referer contains the origin , the comparison should be the other way round; Try:
sQuery = "SELECT * FROM pbs WHERE '" & referer & "' like '%' + orgin + '%'"
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
|
|
|
|
|
Please Help....I've been given the following problem, and I'm trying to get some information about technology/techniquest to solve it:
1. System model uses a dbms with a limited number of connections avaiable. Therefore, all communications to the dbms must go through a shared connection pool.
2. Various processes within the system will need to execute queries against the dbms through a pooled connection and then operate directly on the recordsets.
Now, the last time I did a connection pool to a dbms it was a set of classes that were compiled into a process and used ODBC to make the connections to the dbms. All updates to the dbms went through this single process.
What's confusing me is that some developers here are trying to convince me that I can make a connection pool in one central-process, then pass these connections out to other processes that will "do work" and then release the connection back into the free pool held in the central-process. I just don't see how this can work.....Can anyone help point me in a direction where this kind of thing has been done before?
Thankx!!!!
Just trying to keep the forces of entropy at bay
|
|
|
|
|
Does anyone know where I can get the layout for the ldf transaction logs that sql server writes? I want to read some information out of it for an internal program here at work. I can't find any info on this. I know of 2 products that do full log file reading and parsing, so I know the info is available somewhere.
|
|
|
|
|
I have a web app (ASP .NET) that runs a SQL query at the click of a button. I am trying to find if there is a way to check the progress of that query and re-post some information back to the user while it is still running. Any ideas?
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
Hi.
This is a general discussion post, that i've posted in the System Administration forum as well.
I've come to a point where i have a finished ASP.NET web application that i want to distribute. It use ASP.NET web as a front-end, .NET Windows as a front-end for the SQL Server backend db.
I want to create some sort of installation package for my application. I should do the following things:
1) Create FTP login
2) Create Virtual Directory in IIS
3) Copy ASP.NET files to virtual directory
4) Duplicate SQL database
5) Update web.config file in ASP.NET app.
At the moment i have some issues on point 4. What is the best approatch on duplicating SQL server databases programaticly. Are there any pre-made serverinstaller packages? Got any good articles/guitlines on the subject?
In general, i need some info on what is the best approatch to take when distributing a server app.
-Jonas
|
|
|
|
|
Server installation packages usually script out the database objects to a sql script file and bcp the necessary data out to a bcp file. When the installation is run on the target server, this script file is applied to the target database and the data bcp'd back into the target database.
It's also a good idea to let the DBA of the server database review the script file before installation so that he knows what's being done to his database server.
|
|
|
|
|
I using ADO to execute a stored procedure that will return a recordset and some parameters, but if I get the recordset will cause output parameters to be empty.
rs = cmd->Execute( NULL, NULL, NULL );
otherwise, I remove rs then the output parameters will be right.
cmd->Execute( NULL, NULL, NULL );
any idea?
|
|
|
|
|
For SQL-Server, the output parameters are only available after you have closed the recordset.
|
|
|
|
|
Hi
I have a problem with one of my fields in a table.
whenever the value of this field is going to be showed it must be converted to some other value .and when the user inserts a new value (in the second format, because the user knows nothing about the real format of the field) it must automaticly be converted to
the first format before saving.
In Delphi I do it with GetValue and SetValue Events of each field. But in .Net environment I don’t know how can I do that.
Thanx.
With best regards
|
|
|
|
|
I am doing a project in SQLJ and have the source as below:
This code will construct a tree structure from two SQL query using the connect by ... PRIOR statements.
The first SQL query will create the parent.
The Second SQL query will create the childern based on the parent value.A parameter is passed from Query1 to Query2 to establish a relationship between the parent and the child.
My problem now is to construct a Tree using JTree in java based on the above results of the SQL query.i,e the parent & children hierarchy has to be the same. I have tried to use a Hashtable but I am finding it vey difficult.IF SOMEONE HAS A SOLUTION, PLEASE HELP ME WITH AN EXAMPLE.
import java.sql.SQLException;
import oracle.sqlj.runtime.Oracle;
import sqlj.runtime.ref.DefaultContext;
import java.util.*;
#sql iterator iter1(String id,String fdn,int level);
#sql iterator iter2(String clli);
public class GetTree2
{
public GetTree2(String user_name,String password) throws SQLException
{
new TpSess1(user_name,password);
{
usingNamed();
}
finally
{
Oracle.close();
}
}
public GetTree2() throws SQLException
{
new TpSess1();
try
{
usingNamed();
}
finally
{
Oracle.close();
}
}
public static void main(String args[]) throws SQLException
{
new GetTree2(args[0],args[1]);
}
public void usingNamed() throws SQLException
{
iter1 it1=null;
iter2 it2=null;
String temp=null;
String pare1=null;
String par2=null;
String pare3=null;
String strcll1=null;
String strcll2=null;
String strcll3=null;
Vector all = new Vector();
Hashtable lev1 = new Hashtable();
Hashtable lev2 = new Hashtable();
Hashtable lev3 = new Hashtable();
Hashtable lev4 = new Hashtable();
Hashtable cll1 = new Hashtable();
Hashtable cll2 = new Hashtable();
Hashtable cll3 = new Hashtable();
Hashtable cll4 = new Hashtable();
#sql it1={select id,fdn,level from groups connect by prior fdn=parent_fdn
start with fdn='/' };
while(it1.next())
{
all.addElement(it1.id());
switch(it1.level())
{
case 1: lev1.put(all.elementAt(0),it1.id());
pare1 = it1.id();
break;
case 2: lev2.put(pare1,it1.id());
par2 = it1.id();
break;
case 3: lev3.put(par2,it1.id());
pare3 = it1.id();
break;
case 4: lev4.put(pare3,it1.id());
break;
}
temp=it1.fdn();
#sql it2= {select clli from nes where parent_fdn=:temp order by clli };
while(it2.next())
{
switch(it1.level())
{
case 1: cll1.put(all.elementAt(0),it2.clli());
break;
case 2: strcll2 = it1.id();
cll2.put(strcll2,it2.clli());
break;
case 3: strcll3 = it1.id();
cll3.put(strcll3,it2.clli());
break;
case 4: strcll4 = it1.id();
cll4.put(strcll4,it2.clli());
break;
}
}
}
it1.close();
it2.close();
}
}
|
|
|
|
|
Parameters.Refresh() method created all parameters that are stored process provide. but I can't obtain the value of output parameter after execute.
Thank you very much.
|
|
|
|
|
Hi,
Our company writes simulation and optimisation software. Because of that, we need:
1. a consistent view of the data
2. fast access to the data
Therefore all relevant data is loaded from the database at once, and all optimisation and simulation is performed on the data in memory.
We do this since the late 80s on databases like Vax/Rdb, Ingres and Oracle. All of these databases offer the possibility of starting a Read-Only Transation, i.e. all queries performed in the transaction 'see' the data like it was at the start of the transaction, even if it was modified by some other user in the mean time.
We are now considering Microsoft's SQL Server, but apparently it does not offer the possibility of Read-Only transactions. This means that if our application starts up and wants to load all relevant data of the database, it has to use a 'serializable' transaction (actually putting a Read lock on all the tables) to be sure that consistent data is read.
This means that:
- during a start-up, nobody can save
- during a save, nobody can start-up
I'm stunned to see that SQL Server does not offer Read-Only transactions.
Probably most of the [database] world is developing OLTP-type applications, but somewhere there must be somebody writing applications that need to load big parts of the database.
How do these people solve that problem?
Did anybody encounter this problem also and has found a solution for it?
Thanks in advance.
Enjoy life, this is not a rehearsal !!!
My Articles:
- Implementing a Subject/Observer pattern with templates
- Different ways of writing class factories
- AutoRunner: a template class to automatically run start- and cleanup-code in code blocks
</
|
|
|
|
|
It looks like you need to search in Books Online for Transaction Isolation Levels. More specifically, the SERIALIZABLE isolation level that prevents dirty reads.
|
|
|
|
|
|
Working with a table containing 2 million records I want to get the last record for each group.
Example: <br />
ID Field1 Field2 Field3 DateEntered<br />
1 tom a b 12/12/00<br />
2 tom b c 1/1/01<br />
3 jack d e 2/2/01<br />
4 tom d e 1/2/02<br />
5 me a d 1/2/02<br />
6 jack a b 2/2/02<br />
7 me d d 3/3/03
I want to get only IDs 4, 6 and 7, because they are the last orders for tom, jack and me. Because of the size of the table using a cursor is out of the question. Anyone know of a good way this can be done.
Thanks,
Jason W.
|
|
|
|
|
SELECT a.* from Table1
INNER JOIN
(SELECT field1, max(dateentered) AS zDateEntered
FROM table1
GROUP BY field1)
b
ON a.field1 = b.field1 and a.DateEntered = b.zDateEntered
|
|
|
|
|
Very nice… That’s exactly what I was looking for thanks.
Jason W.
|
|
|
|
|
Hi All,
I’m handling events of ADO in an ATL out-of-process server, and for some reasons when I use _ATL_FREE_THREADED declaration event ConnectComplete is not called when I establish an asynchronous connection, thou it is called when I use a synchronous connection. Changing the memory model to _ATL_APARTMENT_THREADED solves the problem, but what is the reason of such strange behaviour anyway, and what’s the
proper solution?
Regards,
Vitaly Tomilov
|
|
|
|
|
There are two SQL Server tables; parent table "Adressen", child table "Details". Details is related with field "adid" to parent table "Adressen". A new Adress Row has multiple DetailsRows.
"adid" is the primary key of "Adressen" and grows 1 by row.
I work with typed Sql Server tables and C#.
simplyfied:
AdressenRow adr_row=new ds1.Adressen.NewAdressenRow();
DetailsRow det_row=new ds1.Details.NewDetialsRow();
//Add the knew Rows
ds1.Adressen.AddAdressenRow(adr_row);
ds1.Details.AddDetailsRow(det_row);
//Update Adressen
xDataAdapter.Update(ds1.Adressen);
//Now I need to have the "adid" of the Inserted Row to set it also in the new DetailsRow but in the DataSet.Adressen Table, adid of the new created AdressenRow is "0".
How I can get this id? Is there the possibility to make a cunning Insert- or Update-Statement?
What's the best way to solve this little problem?
What's the way to solve the problem that DataSource and DataSet is not synchronized?
Thanks
Stefan
|
|
|
|
|
You may have to change your code a bit, but here's the gist:
First, you need a stored procedure like this:
CREATE PROCEDURE [addaddressen]
@param1 varchar(100),
@adid int output
AS
insert into addressen (param1) values (@param1)
select @adid = @@IDENTITY
GO
Notice the @@IDENTITY field. This sql variable contains the ID of the row you just inserted. Then your C# code to retrieve that value would look like this:
SqlConnection SqlCon = new SqlConnection("your_connection_string");
SqlCommand SqlCmd = new SqlCommand("addaddressen", SqlCon);
SqlCmd.CommandType = CommandType.StoredProcedure;
SqlParameter sParam;
sParam = SqlCmd.Parameters.Add(new SqlParameter("@param1",
SqlDbType.VarChar, 50));
sParam.Value = "Test Addressen";
sParam = SqlCmd.Parameters.Add(new SqlParameter("@adid",
SqlDbType.Int));
sParam.Direction = ParameterDirection.Output;
SqlCon.Open();
SqlCmd.ExecuteReader(CommandBehavior.CloseConnection);
string adID = SqlCmd.Parameters["@adid"].Value.ToString();
The string adID now contains your id value of the record you just inserted into addressen. You can now insert into your details table with this ID.
I hope this helps.
-Matt
p.s. You can just do the whole thing in a single stored procedure, like this:
CREATE PROCEDURE [addaddressen]
@param1 varchar(100),
@detailParam1 varchar(100),
@adid int output
AS
insert into addressen (param1) values (@param1)
select @adid = @@IDENTITY
insert into details (adid, detailParam1) values (@adid, @detailParam1)
GO
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
Thank you for your explainations!
Inbetween I've found now exactly what you wrote to me. But I use now SCOPE_IDENTITY() instead of @@IDENTITY as returnvalue. One thing to add: I use now SetParentRow() of the ChildRows to set the correct id of the ChildRows automaticly when updating the Details Table.
Thanks
Stefan
|
|
|
|
|
I have a toolbar in a form. The text of the buttons on the toolbar are like "&New", "&Edit", "&Search".
But the buttons ButtonClick Event is not fired when I use ALT+"n" or ALT+"e". and so not accessible with the keyboard.
What have I to do that I can access the buttons ButtonClick Event with ALT+"X"?
Thanks
Stefan
|
|
|
|