|
Hi Everyone,
I am running my program where i am using pubs database, authors table of Sql. But while updating (dataadapter.update (dataset,"authors") ,it gave me this error:
An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in system.data.dll
Additional information: System error.
I used try catch to catch the exception, it gave me this error:
line1 : Incorrect syntax near ','.
(I have passed parameters, passed update statement)
I have downloaded the code from this site
http://www.programmersheaven.com/2/Les_VBNET_13_p4[^]
I am putting code for your kind reference
Private Sub InitializeCommands()<br />
' Preparing Insert SQL Command<br />
dataAdapter.InsertCommand = conn.CreateCommand()<br />
dataAdapter.InsertCommand.CommandText = "INSERT INTO authors au_id, au_fname, au_lname, address VALUES @au_id, @au_fname, @au_lname, @address"<br />
<br />
AddParams (dataAdapter.InsertCommand, "au_id", "au_fname", "au_lname", "address")<br />
dataAdapter.UpdateCommand = conn.CreateCommand()<br />
dataAdapter.UpdateCommand.CommandText = _<br />
"UPDATE authors au_id = @au_id, au_fname = @au_fname, au_lname = @au_lname,address = @address WHERE au_Id = @au_Id"<br />
AddParams(dataAdapter.updateCommand, "au_id", "au_fname", "au_lname", "address")<br />
<br />
dataAdapter.DeleteCommand = conn.CreateCommand()<br />
dataAdapter.DeleteCommand.CommandText = "DELETE FROM article WHERE au_id = @au_Id"<br />
AddParams(dataAdapter.DeleteCommand, "au_Id")<br />
End Sub<br />
<br />
Private Sub AddParams(ByVal cmd As SqlCommand, ByVal ParamArray cols() As String)<br />
' Adding Hectice parameters in SQL Commands<br />
Dim col As String<br />
For Each col In cols<br />
cmd.Parameters.Add("@" + col, SqlDbType.Char, 0, col)<br />
Next<br />
End Sub<br />
<br />
Private Sub btnSave_Click(ByVal sender As System.Object, _<br />
ByVal e As System.EventArgs) Handles btnSave.Click<br />
lblLabel.Text = "Saving Changes..." <br />
Me.Cursor = Cursors.WaitCursor<br />
Dim row As DataRow = dataTable.Rows(currRec)<br />
row.BeginEdit()<br />
row("au_id") = txt1.Text <br />
row("au_fname") = txt2.Text<br />
row("au_lname") = txt3.Text<br />
row("address") = txt4.Text<br />
row.EndEdit()<br />
dataAdapter.Update(ds, "authors")<br />
ds.AcceptChanges()<br />
ToggleControls(True)<br />
insertSelected = False<br />
Me.Cursor = Cursors.Default<br />
lblLabel.Text = "Changes Saved"<br />
End Sub<br />
Thanking you and waiting for some kind replies.
Amit
|
|
|
|
|
I think the problem is you are missing the SET keyword on your update statement.
UPDATE tablename SET <column> = <value>, <column> = <value> ......
|
|
|
|
|
Looks like my reply may not be clear. Maybe I was typing too fast or my using a less than, greater than sign around the words "column" and "value" created a problem.
Anyhow - let me try again.
UPDATE tablename SET column_name = value, column_name = value, .... etc.
I believe you need to specify the SET keyword as part of the UPDATE command.
|
|
|
|
|
Thanks for your reply but i'm using set keyword near update statement. I have given the update statement and fieldnames.
Please refer my question.
Thanks again.
Amit
|
|
|
|
|
As the previous poster pointed out, your update query -"UPDATE authors au_id = @au_id, au_fname = @au_fname, au_lname = @au_lname,address = @address WHERE au_Id = @au_Id"
is missing the keyword 'Set'
it should be "UPDATE authors Set au_id = @au_id, au_fname = @au_fname, au_lname = @au_lname,address = @address WHERE au_Id = @au_Id"
Since it is missing, the sql parser detects an error at the first comma
Absolute faith corrupts as absolutely as absolute power
Eric Hoffer
All that is necessary for the triumph of evil is that good men do nothing.
Edmund Burke
|
|
|
|
|
Hey Thanks everyone. My Problem got solved i missed one quotes.
|
|
|
|
|
Hi
i have 2 tables T1( ID int, content ntext) and T2(ID int, content ntext)
i want to fill T2 with T1 rows.
4 some reasons i should reade T1.ID and write theme to T2 and then
read T1.Content and write theme to T2.Content. What should i do plz???
|
|
|
|
|
INSERT INTO T2
(
id,
content
)
SELECT
id,
content
FROM
T1
|
|
|
|
|
Hi,
I have a query in my stored procedure that bring back the role name and description based on the ID supplied. If it found the role, it bring back a 0. Now I only want it to create a Role instance and populate it if 0 is returned. But it moaning about the cast
intResult = (int)objCmd.Parameters["@Return_Value"].Value;
I would've liked to replced if (objDr.HasRows) with if (intResult == 0). Is the way to do it, or is there some other way?
Here is my piece of code:
using (SqlConnection objConn = new SqlConnection(PLATTERGlobals.ConnectionString))
{
using (SqlCommand objCmd = new SqlCommand("sp_Roles_GetRoleByID", objConn))
{
// Mark the command as a SPROC
objCmd.CommandType = CommandType.StoredProcedure;
// Add parameters to SPROC
AddParameterToSQLCmd(objCmd, "@RoleID", SqlDbType.Int, 4, ParameterDirection.Input, intRoleID);
// Open the connection
objConn.Open();
using (SqlDataReader objDr = objCmd.ExecuteReader())
{
//intResult = (int)objCmd.Parameters["@Return_Value"].Value;
// Check for a positive return
if (objDr.HasRows)
{
while (objDr.Read())
{
objRole = new Role();
objRole.RoleName = objDr.GetString(0);
objRole.RoleDescription = objDr.GetString(1);
}
}
}
}
}
I hope someone can help.
Regards,
ma se
|
|
|
|
|
Hello,
I am currently working on a project with SQL Server 2005 and I must say that I'm a beginner with SQL server.
I have created a new login for server, and after have created a new user for my database. After this I tryed to connect with the new user but got the following error message:
TITLE: Connect to Server
------------------------------
Cannot connect to ANDREIC-PC\SQLEXPRESS.
------------------------------
ADDITIONAL INFORMATION:
A connection was successfully established with the server, but then an error occurred during the login process. (provider: Shared Memory Provider, error: 0 - No process is on the other end of the pipe.) (Microsoft SQL Server, Error: 233)
What could be the cause for this failure?
Thank you in advance!
AndreiC
Croitoriu Andrei
andrei.croitoriu@gmail.com
|
|
|
|
|
Did you get this error in the database explorer using Visual Studio or Visual Web Developer? I got the same error when I use VWD, but this happens only every now and then. I just click on the treeview to expand my database then it asks for a password, and it works fine.
I hope this solves your problem, and I hope someone else can explain this problem to all of us.
Regards,
ma se
|
|
|
|
|
hi there,
I get an error whenever I Download my .net application to a Client , I have reports in my application and the reports won't work with an error cannot find find keycodev2.dll or invalid keycode, I tried to register this dll and it succeeded but i still have the error and my reports are not working
please helpppppppp
-- modified at 1:30 Monday 27th March, 2006
|
|
|
|
|
It seems that you have Visual Studio .NET 2003
In this case, you should create a setup project, add all Crystal merge modules to project. In Crystal_Regwiz2003 properties, expand MergeModuleProperties and enter license key (you can find license key for Crystal in about dialog of VS)
Hope that help
|
|
|
|
|
thanks but it didn't work i still have the same error, any other suggestions?
|
|
|
|
|
hai all,
i have a table named 'applcn', it conatin near 100 field
i want to alter one column to not null
for that i use the folllowing query
alter table applcn alter column txtreforg3 nvarchar not null
but it show error like
Server: Msg 8152, Level 16, State 6, Line 1
String or binary data would be truncated.
The statement has been terminated.
how i slovw this???urgent
All I ever wanted is what others have....
CrazySanker
|
|
|
|
|
Hi i believe your statement
'alter table applcn alter column txtreforg3 nvarchar not null'
does not specify the column length which its will automatically give a default length value = 1 for txtreforg3 which you already has some data more than length = 1
So i suggest you make your statement
'alter table applcn alter column txtreforg3 nvarchar(x) not null'
x = depend the max length of your data in table.
-C-?-M-
|
|
|
|
|
I have a MySQL 4.1 DB. When I am selecting from it by using ODBC driver instead of some russian characters I get only "???????? ??"
Default character set in DB is cp1251.
Is it possibly to set in Connection String which character set to use?
|
|
|
|
|
Monin D. wrote: I have a MySQL 4.1 DB. When I am selecting from it by using ODBC driver instead of some russian characters I get only "???????? ??"
Default character set in DB is cp1251.
Disclaimer,
I haven’t had to work with any language other than English.
I have noticed over the years that there are language specific ODBC drivers. Make sure you’re using the right ODBC driver for the language.
Good luck
|
|
|
|
|
Did you guys tried "Drilldown" feature in SQL Server 2005's "Reporting Services"? I implemented a report with drilldown - it works perfectly on Visual Studio 2003 Report Designer, I manage to build, render, view the report and toggle the "+" (and "-") to collapse/expand drilldown button.
However, when I tried to access the report via URL Access+Browser (IE):
http://localhost/reports/MySalesReports/sales_rpt1
Then drilldown stopped working. The "+" button is rendered, but when you click on it nothing happens. I am suspecting clientside/browser setting... anyone ran into this problem before?
Norman Fung
|
|
|
|
|
Hi, I'm investigating if it's possible to dynamically add column to selected report hosted by SQL Server's Reporting Service?
In my quest to resolve this problem I came across this article: http://www.codeproject.com/dotnet/DynamicReport.asp
Basically, the author's approach is to pass selected report a paratmer (plain old report parameter just like any other). The report toggle column property "visibility" of selected columns based on this parameter - but these columns needs to be defined ahead of time.
I'm looking for a way to truely dynamically add column to reports (rdl files loaded to Report Server). Thinking of further exploring Reporting Service Web Service Library - you can adjust web service properties, specify report paramters and retrieve report but it does not look like it will let you dynamically . Any idea? Thanks.
Norman Fung
REF:
MSDN - Reporting Services Web Services Library
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/RSPROG/htm/rsp_prog_soapapi_dev_3g0y.asp
|
|
|
|
|
folks,
The case is to induct the SQL Server 2005 into a huge code base product written primarily to work with SQL Server 2000 (for any reasons…).
Changing the code-base is not a good option due to the fatal impacts. The only option I see is to customize the existing ODBC driver which is for SQL Server 2000 to be intelligent enough to support for SQL server 2005 too.
What say? Does it sound realistic? Or does some one have insight in such case.?
Any guidance on it shall be helpful.
You have a good day.
-Ashu
- Ashutosh Bhatnagar
- Ashutosh Bhatnagar
|
|
|
|
|
Ashutosh Bhatnagar wrote: The only option I see is to customize the existing ODBC driver which is for SQL Server 2000 to be intelligent enough to support for SQL server 2005 too.
I don't think Microsoft will give you the source for their SQL 2000 ODBC driver.
What 'code-base' are you talking about ?
(C/C++/VB, or store procedures)
ODBC isolates your code (C/C++/VB/...) from the database being used.
It shouldn't matter if you move to SQL 2005 or even (that much) if you move to Oracle or DB2 or ...
Aside from all that, SQL 2005 is likely backward compatible with your SQL 2000 'code-base'.
Can you give an example of what you think you need to change ?
...cmk
Save the whales - collect the whole set
|
|
|
|
|
Hi all,
I am experiencing a problem while running two stored procedures manipulating same table.
While SP1 is performing some updation and SP2 tries to read, even SP2 is reading it waits until SP1 gets completed.
I have really no idea whats happening.
Kindly need your feedback.
thanks.
The Phantom.
|
|
|
|
|
Hi guys, trying to access Reporting Service:
http://localhost/reports
Ran into this: "The underlying connection was closed: The remote name could not be resolved."
Any idea? Thanks.
|
|
|
|
|
i have a problem after i insert some records using insert into when i use select * , the records appear sorted with different order than i enterd it.
|
|
|
|