I am trying to execute the procedure using execute <procedure_name>('A,'B'),
but received an error that the SQL statement cannot be executed.
What am I doing wrong?
Hi guys.
I'm creating a page that searches for an item and then be able to edit/update it. I was able to do it when it returns just one result but when it gives me multiple results I could only edit the very last item. Below is my code:
.......
$dj =$_POST[djnum];
$sql= "SELECT * From dj WHERE datajack LIKE '$dj%'";
$result = mysql_query($sql);
//more code in here//
while ($info =mysql_fetch_array($result)) {
// display the result
echo "<form action=\"dj_update.php\" method=\"POST\"><input type=\"hidden\" name=\"djnumber\" value=\"".$info['datajack']."\">";
echo "<tr><td>DJ ".$info['datajack']."</td>";
echo "<td>".$info['building']." </td>";
echo "<td>Rm ".$info['room']." </td>";
echo "<td>".$info['switch']." </td>";
echo "<td>".$info['port']." </td>";
echo "<td>".$info['notes']." </td>";
echo "<td style=\"text-align:center;\"><input type=\"Submit\" value=\"Edit\" ></td></tr>";
}
// more code here //
Then this is the screen shot of the result:
The idea is the user should be able to click on "Edit" and be able to edit/update that particular item. But when I click any of the Edit button I could only edit the last item. What am I missing here? Is there an easier way to do this?
Thanks guys and Happy new year!
Is it possible to use ASP.NET Dynamic Data with SubSonic 3 in-place of Linq toSQL classes or the Entity Framework? MetaModel.RegisterContext() throws an exception if you use the context class that SubSonic generates. I thought I remembered coming across a SubSonic/Dynamic Data example back before SubSonic 3 was released but I can't find it now. Has anyone been able to get this to work?
Hi All,
I would like to store "2010-03-26 10:13:04 Etc/GMT" value in column of type datetime.
when i try to insert it i got exception
SQLException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '10:13:04 Etc/GMT', at line 1
how to insert data time with time zone.
Thanks in advance.
please help me its urgent.
I'm curious as to the best route (more looking towards simplicity, not speed or efficiency) to sort a DropDownList in C#/ASP.NET - I've looked at a few recommendations but they aren't clicking well with me.
Edit: Folks, I do not have control over how the data comes into the DropDownList - I cannot modify the SQL.
I have a dictionary that is populated with data from a table, we are doing this so we can hold multiple SQL tables inside this object. This approached cannot be discussed.
The Dictionary is mapped as a , and contains SQL column name and the value, and each dictionary resembles one row entry in the Table.
Now I need to display this on a editable gridview, preferably the ASPxGridView.
I already figured out that I should use Dynamic Objects(C#), and everything worked perfectly, up to the part where I find out that the ASPxGridview is built in .NET 2.0 and not 4.0 where Dynamic objects where implemented, therefor I cannot use it...
As you cannot, to my knowledge, add rows to the gridview programmatically, I am out of ideas, and seek your help guys!
protected void Page_Load(object sender, EventArgs e)
{
UserValidationTableDataProvider uvtDataprovider = _DALFactory.getProvider<UserValidationTableDataProvider>(typeof(UserValidationTableEntry));
string[] tableNames = uvtDataprovider.TableNames;
UserValidationTableEntry[] entries = uvtDataprovider.getAllrecordsFromTable(tableNames[0]);
userValidtionTableGridView.Columns.Clear();
Dictionary<string, string> firstEntry = entries[0].Values;
foreach (KeyValuePair<string, string> kvp in firstEntry)
{
userValidtionTableGridView.Columns.Add(new GridViewDataColumn(kvp.Key));
}
var dynamicObjectList = new List<dynamic>();
foreach (UserValidationTableEntry uvt in entries)
{
//dynamic dynObject = new MyDynamicObject(uvt.Values);
dynamicObjectList.Add(new MyDynamicObject(uvt.Values));
}
}
public class MyDynamicObject : DynamicObject
{
Dictionary<string, string> properties = new Dictionary<string, string>();
public MyDynamicObject(Dictionary<string, string> dictio)
{
properties = dictio;
}
// If you try to get a value of a property
// not defined in the class, this method is called.
public override bool TryGetMember(GetMemberBinder binder, out object result)
{
// Converting the property name to lowercase
// so that property names become case-insensitive.
string name = binder.Name.ToLower();
string RResult;
// If the property name is found in a dictionary,
// set the result parameter to the property value and return true.
// Otherwise, return false.
bool wasSuccesfull = properties.TryGetValue(name, out RResult);
result = RResult;
return wasSuccesfull;
}
// If you try to set a value of a property that is
// not defined in the class, this method is called.
public override bool TrySetMember(SetMemberBinder binder, object value)
{
// Converting the property name to lowercase
// so that property names become case-insensitive.
properties[binder.Name.ToLower()] = value.ToString();
// You can always add a value to a dictionary,
// so this method always returns true.
return true;
}
}
Now, I am almost certain that his "Dynamic object" approach, is not the one I can go with from here on.
I hope you guys can help me :)!
Hi,
I've a problem in making a PERL program for matching the words in two documents. Let's say there are documents A and B
So I want to delete the words in document A that's not in the document B
A: I eat pizza
B: She go to the market and eat pizza
result: eat pizza
I use Perl for the system and the sentences in each document isn't in a big numbers so I think I won't use SQL
And the program is a subproram for automatic essay grading for Indonesian Language (Bahasa)
Thanx,
Sorry if my question is a bit confusing. I'm really new to 'this world' :)
Is there a consolidated list of GUIDs for well known VSS writers available somewhere? At least the Microsoft ones like System State, Exchange, SQL, Sharepoint etc.
Is it possible to force java to make you catch RuntimeExceptions? Specifically I am working with the Spring framework and the whole Exception hierarchy is based upon RuntimeExceptions. A lot of the times I forget to try and catch the Exceptions. A specific example is when doing an LDAP query, or an SQL call.
I'm having a hard time determining the best way to handle this... With Entity Framework (and L2S), LINQ queries return IQueryable. I have read various opinions on whether the DAL/BLL should return IQueryable, IEnumerable or IList. Assuming we go with IList, then the query is run immediately and that control is not passed on to the next layer. This makes it easier to unit test, etc. You lose the ability to refine the query at higher levels, but you could simply create another method that allows you to refine the query and still return IList. And there are many more pros/cons. So far so good.
Now comes Entity Framework and lazy loading. I am using POCO objects with proxies in .NET 4/VS 2010. In the presentation layer I do:
foreach (Order order in bll.GetOrders())
{
foreach (OrderLine orderLine in order.OrderLines)
{
// Do something
}
}
In this case, GetOrders() returns IList so it executes immediately before returning to the PL. But in the next foreach, you have lazy loading which executes multiple SQL queries as it gets all the OrderLines. So basically, the PL is running SQL queries "on demand" in the wrong layer.
Is there any sensible way to avoid this? I could turn lazy loading off, but then what's the point of having this "feature" that everyone was complaining EF1 didn't have? And I'll admit it is very useful in many scenarios. So I see several options:
Somehow remove all associations in the entities and add methods to return them. This goes against the default EF behavior/code generation and makes it harder to do some composite (multiple entity) LINQ queries. It seems like a step backwards. I vote no.
If we have lazy loading anyway which makes it hard to unit test, then go all the way and return IQueryable. You'll have more control farther up the layers. I still don't think this is a good option because IQueryable ties you to L2S, L2E, or your own full implementation of IQueryable. Lazy loading may run queries "on demand", but doesn't tie you to any specific interface. I vote no.
Turn off lazy loading. You'll have to handle your associations manually. This could be with eager loading's .Include(). I vote yes in some specific cases.
Keep IList and lazy loading. I vote yes in many cases, only due to the troubles with the others.
Any other options or suggestions? I haven't found an option that really convinces me.
I wanted to make a guestbook for my flash website but I also need to have it sent to my email. Is there a way I can do this without using PHP or my sql? what would be the as2 for it? thanks!
Greetings,
In my Reporting Services report I've added reference to my custom library. It works fine. I can display the string which is returned from my custom library method as follows:
=ClassLibrary1.MyClass.Parse("harry potter")
Above code works fine - it should return SQL query based on passed parameters. My question is, how can I use this code in my DataSource. I'm trying to do something like this:
SELECT * FROM =ClassLibrary1.MyClass.Parse(@searchedPhrase)
But the above code does not work and the error is returned :"Incorrect syntax near ="
I have a list of tuples that I'm trying to incorporate into a SQL query but I can't figure out how to join them together without adding slashes. My like this:
list = [('val', 'val'), ('val', 'val'), ('val', 'val')]
If I turn each tuple into a string and try to join them with a a comma I'll get something like
' (\'val\, \'val\'), ... '
What's the right way to do this, so I can get the list (without brackets) as a string?
I currently have Visual Studio 2008 Professional installed on my Windows 7 (x64) laaptop.
I also have SQL Server 2008 Express installed and Crystal Reports 2008 installed.
Can I upgrade Visual Studio 2008 Pro to Visual Studio 2010 Promimum and if so do I have to make any configuration changes to any other apps I have installed?
Due to a customer requirement I am forced to use classic ASP, so I am wondering if I could use .Net (or maybe JScript which as new features) to try to add some advanced features. I really would like a decent way to connect toSQL Server, so if anyone has any ideas I would appreciate it. Thanks.
Wade
I have a django model with a DateTimeField.
class Point(models.Model):
somedata = models.CharField(max_length=256)
time = models.DateTimeField()
I want to get a count of the number of these objects for each day. I can do this with the following SQL query, but don't know how to do it through django.
SELECT DATE(`time`), Count(*)
FROM `app_point`
GROUP BY DATE(`time`)
Being able to restrict the results to a date range would also be good.
I need LastUpdatedDttm to be updated by SYSDATE whenever record is updated. But below annoataions do nt work as desired. SYSDATE is inserted only once and not updated for subsequent updations. Also, lastUpdDTTM is not part of sql generated by hibernate.
@Generated(GenerationTime.ALWAYS)
@Column(name="LAST_UPDATED_DTTM",insertable=false,updatable=true, columnDefinition ="timestamp default SYSDATE")
private Date lastUpdDTTM;
@Generated(GenerationTime.ALWAYS)
@Column(name="CREATED_DTTM", insertable=false, updatable=false)
private Date createdDTTM;
We're getting this random warning from JBoss.. any idea why?
It happens at random times when there are no active threads. Everything works when any processing resumes.
13:49:31,764 WARN [JBossManagedConnectionPool] [ ] Unable to fill pool
org.jboss.resource.JBossResourceException: Could not create connection; - nested
throwable: (java.sql.SQLException: Listener ref
used the connection with the following error:
ORA-12516, TNS:listener could not find available handler with matching protocol stack
The Connection descriptor used by the client was:
//localhost:1521/orcl
my scrip is supposed to look up contacts in a table and present thm on the screen to then be edited. however this is not this case. I am getting the error
Parse error: syntax error, unexpected $end in /home/admin/domains/domain.com.au/public_html/pick_modcontact.php on line 50 NOTE: this is the last line in this script.
<?
session_start();
if ($_SESSION[valid] != "yes") {
header( "Location: contact_menu.php");
exit;
}
$db_name = "testDB";
$table_name = "my_contacts";
$connection = @mysql_connect("localhost", "user", "pass") or die(mysql_error());
$db = @mysql_select_db($db_name, $connection) or die(mysql_error());
$sql = "SELECT id, f_name, l_name FROM $table_name ORDER BY f_name";
$result = @mysql_query($sql, $connection) or die(mysql_error());
$num = @mysql_num_rows($result);
if ($num < 1) {
$display_block = "<p><em>Sorry No Results!</em></p>";
} else {
while ($row = mysql_fetch_array($result)) {
$id = $row['id'];
$f_name = $row['f_name'];
$l_name = $row['l_name'];
$option_block .= "<option value\"$id\">$l_name, $f_name</option>";
}
$display_block = "<form method=\"POST\" action=\"show_modcontact.php\">
<p><strong>Contact:</strong>
<select name=\"id\">$option_block</select>
<input type=\"submit\" name=\"submit\" value=\"Select This Contact\"></p>
</form>";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Modify A Contact</title>
</head>
<body>
<h1>My Contact Management System</h1>
<h2><em>Modify a Contact</em></h2>
<p>Select a contact from the list below, to modify the contact's record.</p>
<? echo "$display_block"; ?>
<br>
<p><a href="contact_menu.php">Return to Main Menu</a></p>
</body>
</html>
Hi,
I can now if a session contain any changes which must be synchronized with the database with
session.isDirty()
But i have a simple field (modification date) that i would like to be ignore by it.
Example: object Person( name,age,datemodification).
if i just modify the datemodification field i would like that session.isDirty() or othermethod like this to return false so at the end no sql update will occur.
Thanks in advance.
Regards
RedGate makes a tool for Microsoft SQL Server that allows you to snapshot the difference between two databases. It generates the scripts needed to update the database schema while preserving the data.
I need to find a tool like this for the Firebird database. We use Firebird in an embedded fashion, and would like to push out schema updates to remote machines with as little hassle as possible.
I tried the following yaml code:
columns:
created_time:
type: timestamp
notnull: true
default: default CURRENT_TIMESTAMP
In the outputted sql statement, the field is treated as datetime instead of timestamp, which I cannot define the current timestamp in it...
If I insist to use timestamp to store current time, how to do so in yaml?
I need to get an image from a SQL Server as a byte[], and load it to a WebControl.Image. The only seemingly good way to do it that I found is to implement IHttpHandler and handle the request accordingly.
But I'm stuck to using asp.net 1.1. Does it support ashx files?
The authlogic rails gem is doing a LOWER in the sql query.
SELECT * FROM `users` WHERE (LOWER(`users`.email) = '[email protected]') LIMIT 1
I want to get rid of the LOWER part since it seems to be slowing down the query by quite a bit.
I'd prefer to just lower the case in the code since this query seems to be expensive.
I'm not sure where to change this behavior in authlogic.
Thanks!