|
|
Thanks. That's a very handy utility. Can you show me what's the format for -r (resource) argument so I dont have so go over the code? This didn't work for obvious reason:
RunSQL -r localhost -f script.sql
I presume "-r" (resource) is a fully construction connection string? I tried:
RunSQL -r "Data Source=localhost,1433;Initial Catalog=MyDB;User ID=sa;Password=testing" -f "test_RunSQL.sql"
I'm getting a System.ArgumentNullException.
Norman Fung
|
|
|
|
|
"The demo application takes two command line arguments. The first is either a -r (for embedded resource) or -f (for a file). The second argument is either the name of the resource, or the name of the file."
So, you use a -r OR a -f but not both
-r is for an embedded resource. The demo also shows how to embed SQL Scripts as resources in your application so that you don't have to rely on external files.
So all you need is:
RunSQL -r script.sql
Do you want to know more?
WDevs.com - The worlds first Developers Services Provider
|
|
|
|
|
|
for %i in (*.sql) do osql -E %i You might need to use the -U and -P options rather than -E, and you might need to specify -S to run them on another server. If you need to run them in a particular order, remember that NTFS always outputs directory listings in alphabetical order.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Dear CPians,
Is there a way to invoke a Web Service from a Stored Procedure?
Thank you,
theJazzyBrain
Excellence is not an act, but a habit! Aristotle
|
|
|
|
|
Anybody knows about this? Any information please!
<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 fill your database with premium, it runs faster and you get more miles to the gallon.
In other words, what the hell are you talking about ?
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
I don`t know that databse either. That`s why I ask you guys. Maybe there isn`t any premium database.
<italic>Work hard and a bit of luck is the key to success. You don`t need to be genius, to be rich.
|
|
|
|
|
I see - you've just failed to word your question in a way that makes sense. I'd recommend SQL Server as a database, I think Oracle is the main competitor, and it is utterly crap.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
No, no, no. What I meant was, is there any DBMS called "premium".
<italic>Work hard and a bit of luck is the key to success. You don`t need to be genius, to be rich.
|
|
|
|
|
Why would there be ? Have you tried google ?
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Christian Graus wrote:
Why would there be ?
Somebody told me that, I don`t know if it`s exist,or maybe I didn`t listen it correctly. He said that it was a database integrated with business application, like accounting application. I tried google, couldn`t find what i`m looking for.
<italic>Work hard and a bit of luck is the key to success. You don`t need to be genius, to be rich.
|
|
|
|
|
Can I copy a OLAP Service cube from one computer to another? Thanks.
<italic>Work hard and a bit of luck is the key to success. You don`t need to be genius, to be rich.
|
|
|
|
|
Hello,
I am storing in an SQL table data including email addresses. When trying to retrieve via the Select function rows including an email address the program traps because the @ character witin the select statement is a reserved symbol for parameters.
How can i select rows in a table based on email addresses, such that the @ symbols is not interpreted as a special symbol but part of a string parameter.
I tried to use "\@" instead of @ but it doesent work.
Any suggestions are most appreciated,
Daniel
|
|
|
|
|
Can you show us your code?? or give us more information?
Where do you execute the SELECT command? how do you build your query?
Off the top of my mind, if you're using .NET, using parametized queries (see SqlCommand class and its Parameters property) should solve your problem.
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
Dear Luis,
Thank you for your reply.
I have been using visual studio.net form designers to construct a data set object, which included a "SubscribersEmails" table. This table stores one (or more) email addresses a subscriber can use to register.
Following is a code snipplet, which attempts to retrieve one row within the SubscribersEmails table which belong to a specific subscriber (identified by a SubscriberID) and is the row associated with one email address (identified by the anEmailAddress string). Note the SubscribersEmail table includes the columns: SubscriberID and emailAddress.
Dim theEmailRows As DataRow()
theEmailRows = subscriberTableDS.Tables("SubscribersEmails").Select("SubscriberID = " & SubscriberID & "AND emailAddress = " & anEmailAddress)
Since during execution the string anEmailAddress includes the @ sign, the above command fails, complaining about the @ sign.
thanks,
Daniel
|
|
|
|
|
grossd wrote:
theEmailRows = subscriberTableDS.Tables("SubscribersEmails").Select("SubscriberID = " & SubscriberID & "AND emailAddress = " & anEmailAddress)
Since anEmailAddress is a string , you have to use delimiters, in this case single quotes.
....Select("SubscriberID = " & SubscriberID & " AND emailAddress = <big>'</big>" & anEmailAddress & "<big>'</big>") Hope this helps,
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
Hello Luis,
Thank you!,
It works very well now. That was exactly the problem.
Daniel
|
|
|
|
|
You're very welcome! I'm glad I could help!
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
Can anyone help ...
i'm developing an ADO.NET prog., here is a brief description :
--dataSet X contains all tables.
--dataSet Y : temp dataSet for filtering some table views (every search session Y is created and shipped with the chosen table(only one table) from X).
--after the user build the search criteria (by entering some values for some columns or choosing predefined values for lookup columns)he clicks Accept.
-- the Accept button deletes the dirty copy of the table (if exists),which may exists from a previous search session, then Copies another copy(clean one) of the table (original table copied at the start of search session) existing in (Y) and apply the filteration criteria by deleting those rows (from the second table) which does not match the search criteria.
****Important:When the user clicks Accept AGAIN the filtered table (in Y) is deleted and then copy a new one from the already existing one.***********
--after all filteration is done, a dataGrid (M) is bound to (Y) and the filtered table(second table).
**********
PROBLEM
**********
--when the user CHANGES the search criteria (by changing any value or adding new condition), he then presses Accept but (M)refuses to view the updated table.
--note that the first time of search goes ok, but no further results are dispalyed correctly(the first search result lasts forever on M) if the search criteria changes even though the filtered table in (Y) has changed.
****
Code
****
AcceptButton()
{
layer1.ReloadTempTable();
for(int i=0;i
|
|
|
|
|
hi,
i got this table -
Employees:
Id | Name
------------------
1 Avi
2 jack
3 NULL
4 NULL
5 betty
when i query this sql - "select id, name from employees"
i get back a data set with 5 results.
the problem is that its seems like when the query executed , when the query bump into a null value in the Name column, from now on all the results will be null.
it means that the dataset result will be -
Id | Name
------------------
1 Avi
2 jack
3 NULL
4 NULL
5 NULL // SUPPOSE TO BE WITH "betty"
why is that?
(i accord to the problem when i tried to do ds.tables[0].rows[1][4] and it returned dbnull)
|
|
|
|
|
Avi Laviad wrote:
(i accord to the problem when i tried to do ds.tables[0].rows[1][4] and it returned dbnull)
Given the SQL you gave, then this should fail.
What you are saying in this piece of code is that you want the value from table[0] (the first table returned), Rows[1] (the second row, which should contain 2, Jack) and then column[4] (the fifth column is way outside the range - You should get an IndexOutOfRange exception if you run it)
Perhaps, for brevity, you cut too much out of the code and we cannot see the problem anymore.
Do you want to know more?
WDevs.com - The worlds first Developers Services Provider
|
|
|
|
|
i ment ds.tables[0].rows[4][1] - thats return me dbnull.
my code is -
<br />
DataSet ds = DBHelper.Retrieve("select TreeId, owner, Root, BranchTitle, BranchText, LeafText, ScreenShot, Leaf_ScreenShot from Trees");<br />
ArrayList list = new ArrayList();<br />
if (ds.Tables[0].Rows.Count > 0)<br />
{<br />
for (int i=0; i < ds.Tables[0].Rows.Count; i++)<br />
{ <br />
Tree t = new Tree();<br />
if (ds.Tables[0].Rows[i][1] == DBNull.Value)<br />
{<br />
t.Owner = 0;<br />
}<br />
else<br />
{<br />
t.Owner = (double)ds.Tables[0].Rows[i][1];<br />
}<br />
list.Add(t);<br />
}<br />
}<br />
else<br />
{<br />
throw new Exception("No rows found");<br />
}<br />
return list;<br />
and DBHelpr.Retrieve code is
<br />
public static DataSet Retrieve(string Sql)<br />
{<br />
DBFactory db = DBFactory.Instance;
IDbConnection conn = db.connect(Constants.ConnStr);
IDbDataAdapter adapter = db.getAdapter(Sql, conn); <br />
DataSet ds = new DataSet();<br />
<br />
adapter.Fill(ds);
db.disconnect(ref conn);
<br />
return ds;<br />
}<br />
any hint?
|
|
|
|
|
Hello,
I'm having problems retrieving the values of a stored procedure's output parameters. I don't know if the problem is in the stored procedure or in the code.
When the procedure is executed, the records in the three tables are inserted correctly, and the identity from the first table is stored correctly in the other two tables.
When I try to get the value of the parameter after the ExecuteNonQuery call, an InvalidCastException exception is thrown. This is my code:
SqlCommand cmd = conn.CreateCommand();
cmd.CommandType = CommandType.StoredProcedure;
cmd.Transaction = trans;
cmd.CommandText = "ReprDist_InsertDistributor";
cmd.Parameters.Add("@ID_representante", data.RepID);
cmd.Parameters.Add("@NombreComercial", (string) row["NombreComercial"]);
cmd.Parameters.Add("@Password", (string) row["Password"]);
SqlParameter paramDistID = cmd.Parameters.Add("@ID_distribuidor", SqlDbType.Int);
paramDistID.Direction = ParameterDirection.Output;
SqlParameter paramCompID = cmd.Parameters.Add("@ID_empresa", SqlDbType.Int);
paramCompID.Direction = ParameterDirection.Output;
SqlParameter paramUserID = cmd.Parameters.Add("@ID_usuario", SqlDbType.Int);
paramUserID.Direction = ParameterDirection.Output;
cmd.ExecuteNonQuery();
data.DistID = (int) paramDistID.Value;
data.CompanyID = (int) paramCompID.Value;
data.UserID = (int) paramUserID.Value; and this is my stored procedure:
ALTER PROCEDURE ReprDist_InsertDistributor
(
@ID_representante int,
@NombreComercial varchar(70),
@Password varchar(20),
@ID_distribuidor int OUTPUT,
@ID_empresa int OUTPUT,
@ID_usuario int OUTPUT
)
AS
INSERT INTO Empresas (NombreComercial, Direccion, Ciudad, Estado, Telefono, DireccionWeb, EMail, RazonSocial, DireccionFiscal, RFC)
VALUES (@NombreComercial, @Direccion, @Ciudad, @Estado, @Telefono, @DireccionWeb, @EMail, @RazonSocial, @DireccionFiscal, @RFC);
SELECT @ID_empresa = @@IDENTITY;
INSERT INTO Distribuidores (ID_empresa, ID_representante) VALUES (@ID_empresa, @ID_representante);
SELECT @ID_distribuidor = @@IDENTITY;
INSERT INTO Usuarios (Nombre, Apellido, Telefono, EMail, NombreUsuario, Password, ID_empresa)
VALUES (@Nombre, @Apellido, @TelefonoContacto, @EMailContacto, @NombreUsuario, @Password, @ID_empresa);
SELECT @ID_usuario = @@IDENTITY;
RETURN; If anyone can help me out, I'd appreciate it very much!
Thanks!
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|