hi,
System.Data.SqlClient.SqlException: Line 1: Incorrect syntax near '*'. at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
This is the error generated in the del.aspx page.
from the webform1.apsx page there is a delete hyperlink which goes to
del.aspx file ie the below file and sqlComm.ExecuteNonQuery()is generating the above error message.there is no problem with the sql statement.i printed it out.its passing the data properly.ie
DELETE * FROM teachers where TID ='1010'
<%@ Page Language="
VB" ContentType="text/html" ResponseEncoding="iso-8859-1" %>
<%@ Import Namespace="System.Data"%>
<%@ Import Namespace="System.Data.SqlClient"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<script language="
vb" runat="server">
Sub Page_Load
dim cv as string
dim str as string
Dim strConnection As String = "user id=sa;password=admin;server=.;initial catalog=students"
Dim cn As SqlConnection = New SqlConnection(strConnection)
cn.Open()
str=(Request.QueryString("cv"))
Dim strSelect As String = "DELETE * FROM teachers where TID ='"& str &"' "
response.write(strSelect)
response.End()
Dim sqlComm As new SqlCommand(strSelect,cn)
try
sqlComm.ExecuteNonQuery()
catch ex as exception
response.Write(ex.ToString())
finally
cn.close()
end try
response.redirect("table1.aspx")
end sub
</script>
<body>
<form name="form1" method="post" action="table1.aspx">
</form>
</body>
</html>