|
is this query correct?
"INSERT INTO Create(names,city,state,email,username,pword,securityq,answer) VALUES('" + name + "','" + city + "','" + state + "','" + email + "','" + user + "','" + pswd + "','" + question + "','" + ans + "')";
error is Incorrect syntax near the keyword 'Create'
|
|
|
|
|
INSERT INTO table_name (column1, column2, column3,...)
VALUES (value1, value2, value3,...) is the synatax from w3schools.com[^]
is Create your table name?
try putting insert into `create` (...) values(...)
example
INSERT INTO `Persons` (P_Id, LastName, FirstName)
VALUES (5, 'Tjessem', 'Jakob')
|
|
|
|
|
What is name, city, etc ? Where do they come from ? It looks to me like your database security is a nightmare.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
"Create" is a reserved word in MSSQL so it cannot be used as the name of a table. Here is a full list of reserved words:
http://msdn.microsoft.com/en-us/library/aa238507(SQL.80).aspx[^]
You should be able to insert into the table by quoting the table name like so:
INSERT INTO "Create" ...
Joe Ceresini
Network Engineer
jceresini@hostmysite.com
Hostmysite.com
modified on Monday, February 2, 2009 7:10 PM
|
|
|
|
|
I'm trying to display content from db, but i'm getting this error on my page
ExecuteReader requires an open and available Connection. The connection's current state is closed.
My code is this:
public partial class admin_Default2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
GetPageData();
}
private void GetPageData()
{
DBConnection obj = new DBConnection();
SqlDataReader reader;
DataTable dt = new DataTable();
string query = string.Empty;
try
{
query = "select * from menus order by name";
reader = obj.ExecuteRecordSet(query);
dt.Load(reader);
}
catch (Exception ex)
{
errlbl.Text = ex.Message.ToString();
}
finally
{
obj.CloseConnection();
}
GridView1.DataSource = dt;
GridView1.DataBind();
}
protected void lkAdd_Click(object sender, EventArgs e)
{
Response.Redirect("addmenus.aspx");
}
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
GridView1.PageIndex = e.NewPageIndex;
GetPageData();
}
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
}
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
string query = "delete from menus where id=" + GridView1.DataKeys[e.RowIndex].Value.ToString();
DBConnection obj = new DBConnection();
try
{
obj.ExecuteSql(query);
}
catch (Exception ex)
{
}
GetPageData();
}
}
|
|
|
|
|
Sure would be nice for you to just post the pertinent code, or point out what line has the issue
DBConnection obj = new DBConnection();
SqlDataReader reader;
DataTable dt = new DataTable();
string query = string.Empty;
try
{
query = "select * from menus order by name";
reader = obj.ExecuteRecordSet(query);
dt.Load(reader);
So, obj is a DBConnection. What is that ? A custom class ? Where does it say that you specified a database to connect to, and connected to it ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
|
|
Hi,
I am working on asp.net. I want to add the drag and drop functionality on the controls. I managed to draw the controls but could any one tell how I can add drag drop functionality in it. I tried using Microsoft.Web.Preview but it creates a havoc ..is there any other way? Any kind of help or e article/example web link will be good support .
Thanks in advance!!
|
|
|
|
|
webparts section in asp.net toolbox will fullfill your requirement to achieve drag and drop functionality..
umerumerumer
|
|
|
|
|
|
Hello EveryBody....
I want help. can any one plz suggest me that what can i do becoz i want to compare the value from a database field that contains about 160 millions records. for Example
table contains a field called Email taht contains about 160 millions Adresses. Now when some one enters new email Address. Now i want to compare with existing records and remove them if a duplicate Entry Exists.
|
|
|
|
|
AhmedNisar82 wrote: what can i do becoz i want to compare the value from a database field that contains about 160 millions records
Index it first.
AhmedNisar82 wrote: Now i want to compare with existing records and remove them if a duplicate Entry Exists.
Cache this information in your application memory and od the comparision from the in memory records.
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Manas Bhardwaj wrote: Cache this information in your application memory and od the comparision from the in memory records
That is a seriously screwed up idea! You are crazy if you think that's a good idea.
Let SQL Server do what SQL Server is best at and have it do the comparison rather than saturate your network with 160 million rows of data and then bring the client PC to its knees because you've just dumped a shed-load of data in it.
What do you think the memory requirements are for 160 million rows?
Assume an integer primary key: 4 bytes
Assume each address is an average of say 32 characters (using a western alphabet) 32 bytes.
36 bytes * 160 million = 5,760,000,000
In total that is just shy of 6Gb you want to dump in RAM! On top of that you have overhead for the operating system, other applications and so on.
[UPDATE] Okay, I misready what sort of address. If we assume 20 bytes for an email address, the memory requirement is less, but it is still significant. 24 * 160 million = 3.8Gb
modified on Monday, February 2, 2009 11:45 AM
|
|
|
|
|
thnx 4 ur comments....
my application runs on server not on the client side......
So.?????????
|
|
|
|
|
AhmedNisar82 wrote: my application runs on server not on the client side
Be aware that "client" in the context that I used it meant any process outside of SQL Server i.e. Any client of SQL Server.
The "client" could be on the same machine as SQL server, or another machine. Either way the effect of memory consumption is the same. If the process is on the same machine as SQL Server then you don't have the network bandwidth issues.
|
|
|
|
|
AhmedNisar82 wrote: Now i want to compare with existing records and remove them if a duplicate Entry Exists.
If you do this you won't have to remove stuff because you can prevent the duplicate being inserted in the first place.
IF EXISTS (SELECT * FROM MyTable WHERE Email = @newEmail)
BEGIN
-- Perform action based on email address already existsin
END
ELSE
BEGIN
-- Perform action based on email address not existing.
END
|
|
|
|
|
thnx Colin. thats nice and helpfull. but what can i do with the old records saved on the server. Any suggestion.
|
|
|
|
|
You can find duplicates using something like this:
SELECT MAX(PrimaryKey), COUNT(*)
FROM MyEmailTable
GROUP BY EmailAddress
HAVING COUNT(*) >= 2
The above gives you a list of duplicate rows. You can then use that to delete the duplicates.
e.g.
DELETE FROM MyEmailTable
WHERE PrimaryKey IN
(
SELECT MAX(PrimaryKey)
FROM MyEmailTable
GROUP BY EmailAddress
HAVING COUNT(*) >= 2
)
Also note that it will only remove one duplicate per email address, if there are multiple duplicates then you have to run it multiple times.
NOTE: The above SQL hasn't been tried and may have some syntax errors. Always test on a development database. Do not run this on a live database until you are sure it works they way you want.
|
|
|
|
|
Hi,
May i know how can i run an consoleapplication.exe as a part of MSI package created for asp.net application....
ie whenever i install my msi package in a system and after installing my exe(generated by consoleapplication)(which is attached to msi) should be running...
ie how should i attach my exe to msi (in a nutshell)....
|
|
|
|
|
Hi,
I want to change the gridview cell background color when user clicks it or double click it. User clicks one cell and this cell color is changed and further user clicks another cell also. I've change the latest clicked cell color also and I've to retain the old cell color also, which is clicked by user earlier. Anybody can help for it? Thanks in adv.
Balasubramanian K.
|
|
|
|
|
override the paint method
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswam@its.co.za
|
|
|
|
|
Hello friends,
I am wishing to create a website for online examination.
Can any one give me the important points not to be missed.
Like how to maintain session, timer etc.
Some usefull links regarding same will help me.
Any type of help from you is appreciated.
Thanks in advance.
|
|
|
|
|
|
hi,
I am unable to debug it..dis error has come for twice or thrice and it restarts itself...Plz help me out...
Richa
|
|
|
|