User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP.NET section within the Web Development category of DaniWeb, a massive community of 361,909 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,559 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting
Views: 1187 | Replies: 8
Reply
Join Date: Jun 2006
Posts: 22
Reputation: infinity4ever is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
infinity4ever infinity4ever is offline Offline
Newbie Poster

Where is the table ????

  #1  
Jun 22nd, 2006
hi... i create a new table with this code

Dim SQLCreate As New SqlCommand
Dim Conn As New SqlConnection
Dim DA As New SqlDataAdapter
Dim DS As New Data.DataSet

'Create DB

SQLCreate.CommandText = "CREATE TABLE test (ID integer NOT NULL)"
SQLCreate.Connection = Conn
Conn.ConnectionString = "Data
Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\RBD.mdf;Integrated
Security=True;Connect Timeout=30;User Instance=True"
DA.SelectCommand = SQLCreate
DA.Fill(DS)

the code works perfectly... but i dont know where the created table is??? when i open the sql server from Visual Studio.net 2005 it shows that the table test is there but when i close it and run microsoft sql 2005 i didn't find the table there!!!!!!!!! i restarted the pc and check again..the table is there in vs2005 but still not in microsoft sql 2005

even if i run the application and pess the button again it tells me that the table test is already there??!!!! so why it is not shown in microsoft sql server 2005??

what is the issue here? i want to save the table as a permenent table not temporary one
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jun 2006
Posts: 48
Reputation: Embeza is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
Embeza Embeza is offline Offline
Light Poster

Re: Where is the table ????

  #2  
Jun 22nd, 2006
Originally Posted by infinity4ever
hi... i create a new table with this code

Dim SQLCreate As New SqlCommand
Dim Conn As New SqlConnection
Dim DA As New SqlDataAdapter
Dim DS As New Data.DataSet

'Create DB

SQLCreate.CommandText = "CREATE TABLE test (ID integer NOT NULL)"
SQLCreate.Connection = Conn
Conn.ConnectionString = "Data
Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\RBD.mdf;Integrated
Security=True;Connect Timeout=30;User Instance=True"
DA.SelectCommand = SQLCreate
DA.Fill(DS)

the code works perfectly... but i dont know where the created table is??? when i open the sql server from Visual Studio.net 2005 it shows that the table test is there but when i close it and run microsoft sql 2005 i didn't find the table there!!!!!!!!! i restarted the pc and check again..the table is there in vs2005 but still not in microsoft sql 2005

even if i run the application and pess the button again it tells me that the table test is already there??!!!! so why it is not shown in microsoft sql server 2005??

what is the issue here? i want to save the table as a permenent table not temporary one
Hello, I am Embeza from Ethiopia.
This is my first time to this forum,

I am a begginer of database programming,

To your problem, I suggest that you add the conn.open()
conn.close() SQLCreate.dispose, DA.DataBind()(this is after the
code DA.Fill(DS)).
If i am not right please correct me
Thank you
Reply With Quote  
Join Date: Jun 2006
Posts: 22
Reputation: infinity4ever is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
infinity4ever infinity4ever is offline Offline
Newbie Poster

Re: Where is the table ????

  #3  
Jun 22nd, 2006
hi embeza

thx for replying to me... i appreciate your helping

but there is no need for conn.open() and conn.close() because when you use the dataset its automatically open the connection and close it

but i think is that DA.DataBind()

i'll try it and thanks alot for ur comments
Reply With Quote  
Join Date: Jul 2005
Location: Dallas, TX
Posts: 481
Reputation: campkev is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 19
campkev campkev is offline Offline
Posting Pro in Training

Re: Where is the table ????

  #4  
Jun 22nd, 2006
which database are you looking in when you open sql and don't see it?
I'm guessing that you are creating the table on the default database for that user, instead of the database you are looking at. try master or one of the other databases
Reply With Quote  
Join Date: Jun 2006
Posts: 48
Reputation: Embeza is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
Embeza Embeza is offline Offline
Light Poster

Re: Where is the table ????

  #5  
Jun 22nd, 2006
Originally Posted by campkev
which database are you looking in when you open sql and don't see it?
I'm guessing that you are creating the table on the default database for that user, instead of the database you are looking at. try master or one of the other databases
Hello again Mr. infinity,
I am Embeza.

I would like to know the meaning of the ConnectionString= "Data......."
I just dont know the DataSource,AttachDbFileName...."
Can you help plZZ.
With regard
Reply With Quote  
Join Date: Feb 2003
Location: Canada
Posts: 786
Reputation: Paladine has a spectacular aura about Paladine has a spectacular aura about Paladine has a spectacular aura about 
Rep Power: 9
Solved Threads: 26
Colleague
Paladine's Avatar
Paladine Paladine is offline Offline
Master Poster

Re: Where is the table ????

  #6  
Jun 24th, 2006
What you are doing is still not correct. You are passing a Select Command Object a Create Table Statement and then trying to fill a dataset (a SELECT query result set, which you are not doing) with the result.

There is logically no reason you should ever create a table from the front end. The table should already exist in the Database.
Last edited by Paladine : Jun 24th, 2006 at 1:02 am.
Assistant Manager, Regional Pharmacy Information Systems
TLC Services Website (Under Construction)
Updated : ASP.Net Login Code
Reply With Quote  
Join Date: Jun 2006
Posts: 22
Reputation: infinity4ever is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
infinity4ever infinity4ever is offline Offline
Newbie Poster

Re: Where is the table ????

  #7  
Jun 24th, 2006
hi sorry to be late i didnt have time check the site...

Campkev:

that was the first thing i did...i search in the master and the other database but i didnt find the table i created.

Embeza:

emmm am not very good at explaining but i'll try... actually you are declearing an sqlconnection to establish a connection to the sql database... the connection string include the data source for example if it is from sqlexpress or another version... the attachdbname is the database am using in my project whitch is named RBD in my project... you have other things like integrated security and what is the connection timeout

if am mistaken or not clear i hope that someone explain in better way to embeza.

Paladine:

do you know the correct code to do it ??...its been 3 weeks since am trying to perform this.... in my project i need to create table at the front-end coz each created table will be defferent than the other one, upon to the end-user request...thats why i cant work on an existing table because i dont know what are the tables the end-users want to create.
Reply With Quote  
Join Date: Feb 2003
Location: Canada
Posts: 786
Reputation: Paladine has a spectacular aura about Paladine has a spectacular aura about Paladine has a spectacular aura about 
Rep Power: 9
Solved Threads: 26
Colleague
Paladine's Avatar
Paladine Paladine is offline Offline
Master Poster

Re: Where is the table ????

  #8  
Jun 24th, 2006
Here is a link to doing in Visual Basic.NET, so you will have to make some modifications to this inorder to make it work.

http://msdn2.microsoft.com/en-us/library/ms162203.aspx
Last edited by Paladine : Jun 24th, 2006 at 4:22 am.
Assistant Manager, Regional Pharmacy Information Systems
TLC Services Website (Under Construction)
Updated : ASP.Net Login Code
Reply With Quote  
Join Date: Jun 2006
Posts: 22
Reputation: infinity4ever is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
infinity4ever infinity4ever is offline Offline
Newbie Poster

Re: Where is the table ????

  #9  
Jun 26th, 2006
thx paladine am going though the site
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb ASP.NET Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the ASP.NET Forum

All times are GMT -4. The time now is 9:38 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC