Click here to Skip to main content
15,893,904 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
What hapend in my app?
Can you help me
Change cap in app @oznaka  change to @Oznaka
I must repair all app 
Can you suggets or help me
Thank you


What I have tried:

C#
<pre><pre>string saveStaff = "declare @maxNo integer = 0 select @maxNo = isnull(max(redni_broj), 0) from [dbo].[jedinica_mjere]; Set @maxNo=@maxNo+1;  INSERT into dbo.jedinica_mjere "  
+ " (redni_broj, Oznaka, ime) "  
+ " VALUES (@maxNo,@Oznaka,@ime)";  
  
using (SqlCommand querySaveStaff = new SqlCommand(saveStaff))  
{  
querySaveStaff.Connection = openCon;  
  
querySaveStaff.Parameters.Add("@Oznaka", SqlDbType.VarChar, 255).Value = oznakaTextBox.Text;  
querySaveStaff.Parameters.Add("@ime", SqlDbType.VarChar, 255).Value = imeTextBox.Text;  
Posted
Updated 28-Oct-19 4:04am

That's not necessary - SQL names aren't case sensitive so Oznaka is teh same as oznaka.
And automating the process will work in Visual studio - a simple Replace can do it - but it'll mess up other stuff unless you are very careful: oznakaTextBox for example: C# variable names are case sensitive!
 
Share this answer
 
Comments
Goran Bibic 28-Oct-19 8:10am    
TextBox, combo box and other thing are ok.
Problem is sql query.
Error is..column not exist Oznaka.
When change to oznaka work all ok.
But why happend that?
I must repair complete app
OriginalGriff 28-Oct-19 8:26am    
"@Oznaka" isn't a column name - it's an SQL Variable name, and those aren't case sensitive either:

DECLARE @Oznaka INT
SET @Oznaka = 666
SELECT @oznaka, @Oznaka, @OZNAKA, @OzNaKa

Will give you "666" four times.

If it's saying "Invalid Column name" then that means the column does not exist, and changing t5eh case in your C# code won't fix that. Go back to your DB, and look at the table definition closely: did you misspell the column, or is it in a different table?
Goran Bibic 28-Oct-19 9:32am    
Colunm exist and column name iz oznaka
When change all to oznaka work fine
Goran Bibic 28-Oct-19 9:33am    
Why hapeend that? For all my apps...yesterday was to be ok
Richard Deeming 29-Oct-19 11:39am    
Apparently, if you create a database with a case-sensitive collation, the object names become case-sensitive too.
SQL Server Case Sensitive Collations and DMVs[^]
Generally SQL Server is not Case Sensitive; however, it is possible to set up the Collation of databases, tables, and the respective content which will make SQL Server case-sensitive.

If everything was working fine one day and then stopped; the first thing I would be checking is to see what changed. I think this would qualify and I would be checking what was changed at the database; and not in the client code. I have a strong feeling that there was some sort of collation change.

Perhaps a read through the problem, answers, and referenced articles here will be of assistance:
Collation: SQL Server Column names case sensitivity - Stack Overflow[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900