|
hey
never wrote a stored procedure.. all i do is simply specify the query within the code.. and get it executed..
so could you please elaborate on this.
sorryy..
Kunal Piyush
|
|
|
|
|
hi
i wrote
this piece of code... and i am getting a error stating.. "Invalid Syntax near [valuename]"
string connString = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["diag"].ConnectionString;
SqlConnection conn = new SqlConnection(connString);
try
{
conn.Open();
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = "Select * from '" + DropDownList1.SelectedValue + "'";
SqlDataReader dread = cmd.ExecuteReader();
dread.Read();
while (dread.Read())
{
ListBox1.Items.Add(dread["TestName"].ToString());
}
conn.Close();
}
catch(Exception ex)
{
failed.Text = ex.Message;
}
Kunal Piyush
|
|
|
|
|
cmd.CommandText = "Select * from [" + DropDownList1.SelectedValue + "]";
Regards,
Sylvester G
sylvester_g_m@yahoo.com
|
|
|
|
|
sylvesterg wrote: cmd.CommandText = "Select * from [" + DropDownList1.SelectedValue + "]";
i tried it.. now the error is not coming.. but still no retrival of rows to the listbox as well..
Kunal Piyush
|
|
|
|
|
SQL Server 2000.
A table T has three columns A, B, C.
B is a char column of length 50, containing short phrases, like Thank MC22, MC22 are welcome,
A new mail for MC22 etc.
In this column, all MC22's should be substituted with the word 'you', so that phrases become
meaningful, like Thank you, You are welcome.
Note: whenever MC22 is encountered, EVEN IF IN THE MIDDLE OF A WORD, like abcmc22def,
it should be substituted to abcyoudef.
Everything is case insensitive.
Can someone please write the update statement for me?
Thanks in advance.
ASP - AJAX is SEXY. PERIOD.
|
|
|
|
|
select replace('ThankMC22','MC22','you' )
Regards,
Sylvester G
Senior Software Engineer
Xoriant Solutions
sylvester_g_m@yahoo.com
Score it if you like my post
|
|
|
|
|
Hello Sylvester
I want to know the username and password of SqlExpress.
So i continue my work Pls Help me and let me know
Its Urgent
Thanks and Regards
Aavesh
Dotnet
|
|
|
|
|
No, I don't think you got me.
I have many rows in that table. Here's the scenario: (the actual table)
<code>
Neuron A Neuron B Neuron C
-------- -------------------------------- --------
Passive Thank MC22 Learner
Active MC22 are welcome Learner
Pnode MC22 need a break Veteran
Bnode Hey MC22 Baby</code>
That's what my table is like. Now IN ALL ROWS, IN COLUMN B,
MC22 should be substituted by 'you'.
Thanks in advance.
ASP - AJAX is SEXY. PERIOD.
|
|
|
|
|
update TableName
set [Neuron B] = replace([Neuron B],'MC22', 'You')
Regards,
Sylvester G
Senior Software Engineer
Xoriant Solutions
sylvester_g_m@yahoo.com
Score it if you like my post
|
|
|
|
|
update table_name set column_name = replace(column_name, 'xxx', 'you');
sreeram
|
|
|
|
|
hello
I want to know the username and password of SQlServer 2005 in Mixed Mode Authentication.
its urgent
Pls reply.
Thanks
Aavesh
Dotnet
|
|
|
|
|
im using Username: sa and password: sasa
|
|
|
|
|
Thanks for the Reply
But its not working username sa and password sasa..
I want connect with Sql Express in Sql Server Authentication Mode.
Please tell me Its Urgent.
Thanks and Regards
Aavesh
Dotnet
|
|
|
|
|
Hi guys,
I have some place holder functionality in our Aata Access Layer that should return a properly sorted and paged subset of requested data. However, at the moment we do not have sufficient data to warrant writing the full blown stored procs to implement the most efficient sorting / paging.
However, i would still like to be able to return the correct subset of data in a data table. So how would i go about reducing the contents of the DataTable, whilst retaining the strongly typed data?
Cheers
Tris
Note: Using .NET 2.0
|
|
|
|
|
I would use a DataView and use The RowFilter property, as long as it is a small set. There is also sort functionality in the DataView as well.
Something like:
C#
DataView dv = yourDataTable.DefaultView;
dv.RowFilter = "column1 = '2'";
VB
dim dv as DataView = yourDataTable.DefaultView
dv.RowFilter = "column1 = "'2'";
Then you bind whatever control to the DataView
Hope that helps.
Ben
|
|
|
|
|
Hi Ben,
Thanks for the response.
I need to retain the strong type information of the origional table, basicaly as if the table had been populated origionaly from a pre-sorted and paged SQL query.
Cheers
Tris
|
|
|
|
|
Hello, ALL!
I'am a new user in MS SQL and I have a problem. I have a database backup file. My friend send it to me. I wanna load it into my SQL server (I haven't got that database on my PC). I do it so:
1> restore database new_kupimebel from disk='c:\share\newdb.bak'<br />
2> go
But i got an error
<br />
Msg 5133, Level 16, State 1, Server HOME\SQLEXPRESS, Line 1<br />
Directory lookup for the file "c:\Program Files\Microsoft SQL Server\MSSQL.2\MSSQL\DATA\newdb.mdf" failed with the operating system error 3(Системе не удается найти указанный путь.(rus) System can't find that path (en).).<br />
Msg 3156, Level 16, State 3, Server HOME\SQLEXPRESS, Line 1<br />
File 'newdb' cannot be restored to 'c:\Program Files\Microsoft SQL Server\MSSQL.2\MSSQL\DATA\newdb.mdf'. Use WITH MOVE to identify a valid location for the file.<br />
Msg 5133, Level 16, State 1, Server HOME\SQLEXPRESS, Line 1<br />
Directory lookup for the file "c:\Program Files\Microsoft SQL Server\MSSQL.2\MSSQL\DATA\newdb_log.ldf" failed with the operating system error 3(Системе не удается найти указанный путь.(rus) System can't find that path (en).).<br />
Msg 3156, Level 16, State 3, Server HOME\SQLEXPRESS, Line 1<br />
File 'newdb_log' cannot be restored to 'c:\Program Files\Microsoft SQL Server\MSSQL.2\MSSQL\DATA\newdb_log.ldf'. Use WITH MOVE to identify a valid location for the file.<br />
Msg 3119, Level 16, State 1, Server HOME\SQLEXPRESS, Line 1<br />
Problems were identified while planning for the RESTORE statement. Previous messages provide details.<br />
Msg 3013, Level 16, State 1, Server HOME\SQLEXPRESS, Line 1<br />
RESTORE DATABASE is terminating abnormally.<br />
1>
The directory MSSQL.2 isn't in my PC
C:\Program Files\Microsoft SQL Server>dir<br />
<br />
29.12.2006 20:29 DIR .<br />
29.12.2006 20:29 DIR ..<br />
29.12.2006 20:25 DIR 80<br />
29.12.2006 20:26 DIR 90<br />
29.12.2006 20:26 DIR MSSQL.1<br />
0 files 0 byte<br />
5 dirs 2 763 608 064 bytes free<br />
<br />
C:\Program Files\Microsoft SQL Server>
How can I load that database into my SQL server?
Sincerely,
tradakad
--
"Success is simple. Do what's right, the right way, at the right time."
best regards,
tradakad
|
|
|
|
|
Hi
Just attach existing database instead of restoring database. This is simple as you are not going to restore it... right ??
Harini
|
|
|
|
|
But I haven't got that database on my PC yet. should I create it? i tryed so:
<br />
1> create database newdb<br />
2> go<br />
1> restore database newdb from disk='D:\urban\tmp\newdb.bak'<br />
2> go<br />
Msg 3154, Level 16, State 4, Server I_01\SQLEXPRESS, Line 1<br />
The backup set holds a backup of a database other than the existing 'newdb' database.<br />
Msg 3013, Level 16, State 1, Server I_01\SQLEXPRESS, Line 1<br />
RESTORE DATABASE is terminating abnormally.<br />
1><br />
may be I didn't understand you?
how can I attach that backup file into existing db? thanx!
--
"Success is simple. Do what's right, the right way, at the right time."
best regards,
tradakad
|
|
|
|
|
Hi
Use SQL Enterprise Manager (SQL 2000) to attach database.
Just follow this steps (if you have installed in your machine).
If this is the first time you are opening it. Then you need to register SQL Server. Just right click on the group, Click New SQL Server Registration, do create it using the wizard window.
Once you create it.
Right Click the Database-> All tasks -> Attach Database. And select the backup file. By default 'Attach as' will be your database name, you can change it as your wish.
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Thank you. Harini
|
|
|
|
|
hm.. I have MS SQL 2005 Express Edition. I think there aren't any GUI tools there.. can I do it from sqlcmd?
and another question - I think SQL Enterprise Manager isn't a free tool? can I download it? should I registred it after that?
--
"Success is simple. Do what's right, the right way, at the right time."
best regards,
tradakad
|
|
|
|
|
Use the Enterprise Manager and right click the database and select the restore the database then follow the wizard but dont forget to change the path where the logical database will be store
|
|
|
|
|
I havent got ANY GUI tool so I cant do it. now I download "SQL Server Management Studio Express" but I solved this problem with sqlcmd
1> restore database new_kupimebel<br />
2> from disk='D:\urban\tmp\newdb.bak'<br />
3> with move 'newdb' to "c:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\newdb.mdf",<br />
4> move 'newdb_log' to "c:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\newdb.ldf"<br />
5> go
now all is ok.
thanx 2 all
--
"Success is simple. Do what's right, the right way, at the right time."
best regards,
tradakad
|
|
|
|
|
That is great. You did it.
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Thank you. Harini
|
|
|
|
|
thank you to
i did it.
--
"Success is simple. Do what's right, the right way, at the right time."
best regards,
tradakad
|
|
|
|