|
Will I be so lucky
No matter how long he who laughs last laughs, he who laughs first has a head start!
|
|
|
|
|
Hi there,
I am trying to update a record in my ACCESS database but it is giving an error of following type :
Exception Details: System.Data.OleDb.OleDbException: Syntax error in UPDATE statement.
Source Error:
Line 158: dr.EndEdit();
Line 159: OleDbCommandBuilder cmd=new OleDbCommandBuilder(da);
Line 160: da.Update(ds.Tables[0]);
Line 161:
Line 162: con.Close();
The error is showing in Line 160.
My code is as follows:
private void BtnUpdate_Click(object sender, System.EventArgs e)
{
string strcon="Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + Server.MapPath("~/DB/iMedia.mdb");
OleDbConnection con=new OleDbConnection(strcon);
con.Open();
OleDbDataAdapter da=new OleDbDataAdapter("select * from Users where username='"+UserName+"'",con);
DataSet ds=new DataSet();
da.Fill(ds);
ds.Tables[0].PrimaryKey =new DataColumn[] {ds.Tables[0].Columns["username"]};
DataRow dr=ds.Tables[0].Rows.Find(UserName);
dr.BeginEdit();
dr["username"]=TxtUserName.Text;
dr["password"]=TxtPassword.Text;
dr["name"]=TxtName.Text;
dr["emailid"]=TxtEmailid.Text;
DateTime NewDate=Convert.ToDateTime(TxtMonth.Text+"-"+TxtDate.Text+"-"+TxtYear.Text);
dr["dob"]=NewDate;
dr["address1"]=TxtAdd1.Text;
dr["address2"]=TxtAdd2.Text;
dr["city"]=TxtCity.Text;
dr["state"]=TxtState.Text;
dr["pincode"]=Convert.ToDouble(TxtPincode.Text);
dr["country"]=TxtCountry.Text;
dr["accounttype"]=TxtAccType.Text;
dr["boss"]="d";
dr.EndEdit();
OleDbCommandBuilder cmd=new OleDbCommandBuilder(da);
da.Update(ds.Tables[0]);
con.Close();
}
Anybody can help me regarding this problem.
Thanks,
Nagendra.
|
|
|
|
|
You haven't defined an update statement. Plus, I hope this is not code that's going into any sort of production, because you're breakng the most fundamental rules of development. Your data layer code, including string mashed SQL that is probably wide open for injection attacks, is in the presentation layer.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hello there,
I am glad that u took interest in my problem but this same code worked in other application. I don't know why this is not working here.
|
|
|
|
|
nagendrathecoder wrote: I am glad that u took interest in my problem but this same code worked in other application. I don't know why this is not working here.
So what is different between the "other application" and this one?
|
|
|
|
|
Obviously, as Colin said, there's a point of difference. The MS classes do try to magically create these statements for you, but if you want to actually write code, you should take more control of your DAL than that.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi,
I am trying to set the failure text of my asp:Login control to red but nothing wants to work. I have created my custom login control using the asp:Login control.
<asp:Login
ID="CESignIn"
DestinationPageUrl="~/ControlPanel/Default.aspx"
FailureText="<br />Your sign in attempt was not successful. Please try again."
FailureTextStyle-CssClass="error"
FailureTextStyle-ForeColor="Red"
runat="server">
<LayoutTemplate>
...
...
...
<asp:Literal ID="FailureText" EnableViewState="False" runat="server" />
</LayoutTemplate>
</asp:Login>
Here is my style:
.error
{
color: #ff0000;
}
It is currently black. How do I change it to red. Please can someone help??
Regards
|
|
|
|
|
hai all,
can any one send me the sample code or URl of shopping cart
thanks in advance
Thanks
Subbu.
|
|
|
|
|
No. That's not what we do, we help people with *their* code. If there's no samples in the articles on the site, then try google.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
hi
This is url for the sample ecommerse site.
http://www.x-cart.com/demo/cart.php
Naresh Patel
|
|
|
|
|
|
Method 'Protected Sub Calendar1_DayRender(sender As Object, e As System.Web.UI.WebControls.DayRenderEventArgs)'
does not have the same signature as delegate 'Delegate Sub EventHandler(sender As Object, e As System.EventArgs)'.
|
|
|
|
|
Your event handler does not have the same method signature as the event it has been set up to handle.
Paul Marfleet
|
|
|
|
|
hi,
can anyone help me on the following?
I want to save all the sessions along with its data into sqlserver database. After that I want to fetch n display on UI.
|
|
|
|
|
Are you asking for the code ?
No you should try this by searching google
Any way
One way is put the content of the session in dataset and push that dataset in database table.
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
Go to command mode and go <windows drive="">\WINDOWS\Microsoft.NET\Framework\v2.0.50727
run aspnet_state.exe with appropiate parameters, then configure your web.config.
Muhammad Rashid
|
|
|
|
|
rashidpervaiz08 wrote: Go to command mode and go \WINDOWS\Microsoft.NET\Framework\v2.0.50727
run aspnet_state.exe with appropiate parameters, then configure your web.config.
did you read the post before responding?
I don't think this will solve his problem.
Regards J O H N
"Even eagles need a push." David McNally
|
|
|
|
|
|
Create a Table in the SQL Server to store the session values. If you already have one then....otherwise You decide the structure of the table.
In the front-end to collect the session values use Session.Keys collection class and add the key and values to the DataTable. store it to the Database. Here is a way how to read the session Values...
Dim Key, SessionKey, SessionValue As String
For Each Key In Session.Keys
SessionKey = Key
SessionValue = Session(Key)
'Add the userId, SessionKey and SessionValue to the Table
Next
Regards J O H N
"Even eagles need a push." David McNally
|
|
|
|
|
When the asp.net page is loaded in mozilla browser all the controlls are disabled.I need to enable the controls when the page is loading?
Give me any suggestions..
Nithiyanandhan.S
With regards
Nithiyanandhan S
|
|
|
|
|
nithy_karthik wrote: When the asp.net page is loaded in mozilla browser all the controlls are disabled
Are those controls visible in IE ?
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
Yes all the controls are visible in IE
With regards
Nithiyanandhan S
|
|
|
|
|
Hi there
Can anyone help me, i am trying to design a function that check if a user logged on to the app_ and then if he/she did then prohibit them from logging in twice in a set amount of time.
If anyone can help me i would be most greatfull.
Thanks in advance.
living life on the flip side
|
|
|
|
|
Put one more field count (attempts) in database table where you are storing credentials of user. Make changes in that count
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
Thanks alot for your help, it is much appretiated
THANK A TON!!
living life on the flip side
|
|
|
|