473,386 Members | 1,828 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

change the table name during runtime

my question is that i have to change the table name during runtime. depending on the items selected in the dropdownlist.
i am using asp.net as front end, c# as code behind language, and sql server 2005 as back end.
" i need to change table name in the query in the aspx.cs page"

can i???
Mar 27 '12 #1
4 28418
Gopi
5
Hi jeevan shetty

i cant understand ur problem but you can change the tablename or colum name while we select using alias concept
ex: Select columnname as changecolumname from tablename as changetablename
it give result as changecolumname and changetablename

it is not enough to solve ur problem means
can you post ur code where problem arrives
Mar 27 '12 #2
debasisdas
8,127 Expert 4TB
You need to frame the SQL dynamically at run time and pass the table name as an parameter.
Mar 27 '12 #3
nbiswas
149 100+
Though too late in answering but still ...Since you are writing in Asp.net .cs file, try with

Expand|Select|Wrap|Line Numbers
  1. string tblName = "someTblName";
  2. string str = string.Format("Select * From {0} ", tblName);
Hope this will help
Aug 24 '12 #4
hi you can use the table name in the query.
create a string: strtable as string

recordset like: rs1 as recordset

strtable =put the name of the table here dynamically

rs1.open "select * from " & strtable & " where .....;"

try this and let you and i be friends and work together.

my name is dan on <email removed per forum policy>
Aug 30 '12 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Larry Pits | last post by:
Hi All, Is there any code for ASP.Net to programmatically change the server name within crystal reports? I looked for all technical document at cystal decision site, but no luck. TIA
5
by: Markus Stehle | last post by:
Hi all! I have asp.net web application that uses static impersonation. Is it possible to change the impersonated user during runtime? Within some parts of my application I would like to...
2
by: Balaji | last post by:
Hi All, Can I use more than one membership provider for a given website? I understand only one of them could be default one. If yes, then how to programmatically access the other membership...
1
by: Sankalp | last post by:
Hi, I am using VB 2005. My application has many data bound controls. The connection is stored in the app.config file. I want the application to start with a default connection string and while...
0
by: andremc | last post by:
Hello everyone, I've looked around, but haven't been able to get an exact answer to this question. I have three user roles which have access to their own folders, and an owner role which can...
2
by: mukeshrasm | last post by:
Hi I am creating page dynamically with upload image(more than one) feature. while uploading image I don't know which images are already uploaded so I want to give user a feature to change the file...
3
by: roucha | last post by:
Hey guys, i'm still working on that chat program, and i was wondering if there was a way to modify the name of already created nodes during runtime. i know that you can create them but i don't...
3
by: workingbee | last post by:
I’m writing a unittest, which will clear a table and insert a set of values into the table before it starts to test some stored procs. My problem is that when multiple users are running the test at...
10
irfanafzal
by: irfanafzal | last post by:
Hello I have saved query in MS Access "SELECT ID ,Name, Address from Data2001" I am using this query in Crystal report My question is this can I change table name in this query "DATA2001" to...
2
by: Kyaw Kyaw Min | last post by:
I would like to change table name at SQL2000 database. I use alter statement ALTER TABLE Table_Name RENAME TABLE Old_Name TO New_Name
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.