|
updatecom.CommandText="update test2 set name='" + textBox1.Text + "' job= '" + textBox2.Text +"' title='" + textBox3.Text + "'where id=" + textBox4.Text + "";
Ahmed hassan
|
|
|
|
|
try some comma's between the ' and job and ' and title
|
|
|
|
|
|
And as an addition to the previous post, use parameters for values. You are now for example vulnerable to sql injections.
|
|
|
|
|
1: instead of saying 'not working', tell us what the error is. Putting commas in to fix your SQL will obviously work.
2: read up on SQL Injection attacks, to find out how I can erase your entire database if you release this code
3: tell me you're not really using variables called textBox1, textBox2, etc. Or are you trying to write unreadable code on purpose ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
You may try this:
updatecom.CommandText = "update test2 set name='" + textBox1.Text + "', job= '" + textBox2.Text +"', title='" + textBox3.Text + "' where id='" + textBox4.Text + "'";
Fixed "," and "'"
Saludos!!
____Juan
|
|
|
|
|
Hi,
This might seem pretty basic but can anybody explain why and/or when a method should have the static or virtual? i.e.
public static void Method1()
{}
Thanks,
Prateek
|
|
|
|
|
|
I guess i should have checked msdn first before posting the question.
Thanks
|
|
|
|
|
|
I have a standard Calendar Control:
<asp:calendar id="calNewFirstDateAvailable" runat="server" tooltip="Select First Available Date" xmlns:asp="#unknown">
</asp:calendar>
And I am attempting to set a specific Date as the highlighted date programatically, but it is not highlighting the day in the control.
calUpdateFirstDateAvailable.SelectedDayStyle.BackColor = System.Drawing.Color.Black;
calUpdateFirstDateAvailable.SelectedDayStyle.ForeColor = System.Drawing.Color.White;
calUpdateFirstDateAvailable.SelectionMode = CalendarSelectionMode.Day;
calUpdateFirstDateAvailable.SelectedDate = atsi.StartDate;
calUpdateFirstDateAvailable.VisibleDate = atsi.StartDate;
atis.StartDate is a DateTime type with the value of '{11/12/2008 11:09:03 AM}'
What am I doing wrong?
Any Help would be greatly appreciated.
VS2008 .net 3.5
Thanks,
Robert
|
|
|
|
|
This may be completely wrong, but I recall the order you set the properties may have an affect on what and when is displayed.
BTW: ASP.NET questions belong in the ASP.NET forum.
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 beta 1 - out now! ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
Hello,
I can't seem to find any info regarding this because I don't know what to look for. I really have tried looking on the net, looking on here, searching both articles and message boards, and nothing is quite what I'm needing.
What I'm trying to do is find a component that shows the contents of my drive, similar to looking at the Desktop in the Explorer.
I would also like to have checkboxes next to the folder names so that a user can select multiple folders. Checkboxes are preferred, but if Ctrl+Select is the only option, then ok.
Something like this is out there... I know I've seen it somewhere, but just can't find out what it's called, or any code that uses it as an example.
Any suggestions?
Thanks,
Michael Fritzius
|
|
|
|
|
There's nothing that's standard, it would have to be a user control of some sort.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
That's fine--I'm not set on using anything standard anyway. But I wouldn't even know how to make my own control for this application. Has anyone made something like this?
|
|
|
|
|
|
Excellent. Looks like this would work. Thanks!
|
|
|
|
|
You're welcome
|
|
|
|
|
Hi, i want to convert arrys of one type to arrays of another type
Here is the code that i have
public object ConvertTo(Type myType, object value) {
object[] ret = Array.ConvertAll(value as object[], delegate(object o) { return Convert.ChangeType(o, t.GetElementType()); });
return ret;
}
Everithing its just fine, but the problem using Array.ConvertAll is that I have an object[] reference, an not an t.GetElementType()[] reference
So, when i use the variable returned by that function, i have an InvalidCastException because object[] cannot be converted to myType[]
How can i make a cast to the type i really want?
The next code works perfectly, but i want it to work with a generic type
public object ConvertToStringArray(object value) {
string[] ret = (string[])Array.ConvertAll(value as object[], delegate(object o) { return o.ToString(); });
return ret;
}
Maybe the question is how to create an array of a type represented by an instance of System.Type
Example:
Type t = typeof(System.String);
Saludos!!
____Juan
|
|
|
|
|
Maybe you need to write a generic method that takes a type and creates an array of that type ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
|
hmmm..... sounds good.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
You are almost right
Array.ConvertAll will convert the array, and all the objects included in the array will have the right type (t.GetElementType() in my example)
The problem is, that Array.ConvertAll returns a reference who is an object[], and, when i use this object as a parameter to a method, that gives me an InvalidCastException because it cannot convert from object[] to myType[], i mean, if you want to convert to string[] you may just write
string[] test = (string[]) Array.ConvertAll....
But here the type is given dynamicaly
I fixed it using a not very good strategy, but it works, here is the code:
public object ConvertTo(Type t, object value) {
if (t == null) {
return value;
}
if (t.IsEnum) {
return Enum.Parse(t, value.ToString());
}
if (t.IsArray) {
object[] _valArr;
if (value.GetType().IsArray)
_valArr = value as object[];
else
_valArr = new object[] { value };
Array ret = Array.CreateInstance(t.GetElementType(), _valArr.Length);
Array.ConvertAll(_valArr, delegate(object o) { return Convert.ChangeType(o, t.GetElementType()); }).CopyTo(ret, 0);
return ret;
}
return Convert.ChangeType(value, t);
}
Saludos!!
____Juan
|
|
|
|
|
Hi,
Is there any control available in Visual Studio 2008, which i can use to see pdf files in my Win Form Application, somewhat like RTF controls?
Thanks
Karmendra
|
|
|
|
|