GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

GeekInterview.com  >  Interview Questions  >  Microsoft  >  ADO.NET 2.0
Go To First  |  Previous Question  |  Next Question 
 ADO.NET 2.0  |  Question 17 of 19    Print  
add a field at run time to a table in ado.net
Imports System.Data.SqlClient

Public Class Form1

Dim cn As New SqlConnection("server=.;database=atten;uid=sa;pwd=sa;")

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

'save

cn.Open()

Dim query, query1, query2 As String

Dim regnum As Integer

query1 = "select max(reg) from sdetail"

Dim cmd1 As New SqlCommand(query1, cn)

regnum = cmd1.ExecuteScalar

TextBox1.Text = regnum

query = "insert into sdetail (name) values(" + " '" + TextBox2.Text + "')"

Dim cmd As New SqlCommand(query, cn)

Dim dr As Integer

dr = cmd.ExecuteNonQuery

query2 = "alter table sattend add " + TextBox1.Text + " varchar(50);"



Dim cmd2 As New SqlCommand(query2, cn)

cmd2.ExecuteNonQuery()

cn.Close()

End Sub

End Class

Line 1: Incorrect syntax near '1037'.



1037 is value in textbox1.text






  
Total Answers and Comments: 1 Last Update: April 11, 2008     Asked by: arunsudhakar55 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
April 11, 2008 06:12:51   #1  
waytobala Member Since: April 2008   Contribution: 2    

RE: add a field at run time to a table in ado.net
Column Name do not allow numeric values.choose Charecters.
 
Is this answer useful? Yes | No

 Related Questions

Recordset provides data one row at a time.Dataset is a data structure which represents the complete table data at same time.Recordset has the logic to update and manipulate dataDataset is just a data store 
Latest Answer : Recordset is the Read only & forward only mechanism. But Dataset is the Editable. Recordset is connection oriented and Dataset need connection once to dump the data from the data base. Dataset holds more than one table at a time but recordset holds only ...

Latest Answer : contd...A newly created DataRow has its RowState set to Detached until it is added to the DataRowCollection via the DataRowcollection::Add method. The RowState is initialized to Added until the DataRow::AcceptChanges method is called, at which ...
Read Answers (2) | Asked by : jashuvad

Imports System.Data.SqlClientPublic Class Form1Dim cn As New SqlConnection("server=.;database=atten;uid=sa;pwd=sa;")Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) 
Latest Answer : Column Name do not allow numeric values.choose Charecters. ...


 Sponsored Links

 
Related Articles

ODP.NET - Populating a Dataset with a Single Data Table

ODP NET Populating a Dataset with a Single Data Table A dataset is simply a group of data tables These data tables can be identified with their own unique names within a dataset You can also add relations between data tables available in a dataset mosgoogle The following code gives you the details o
 

jQuery Table Row Finished Code

jQuery Table Row Finished Code The Finished Code Our second example page has demonstrated table row striping highlighting tooltips collapsing expanding and filtering Taken together the JavaScript code for this page is mosgoogle geshibot lang php" document ready function var highlighted
 

jQuery Expanding and Collapsing Table Rows

jQuery Expanding and Collapsing Table Rows The expanding and collapsing behavior added earlier also conflicts with our filters If a section is collapsed and a new filter is chosen then the matching items are displayed even if in the collapsed section Conversely if the table is filtered and a section
 

jQuery Table Row Filtering

jQuery Table Row Filtering Earlier we examined sorting and paging as techniques for helping users focus on relevant portions of a table s data We saw that both could be implemented either with server side technology or with JavaScript Filtering completes this arsenal of data arrangement strategies B
 

jQuery Collapsing and Expanding Table Rows

jQuery Collapsing and Expanding Table Rows When large sets of data are grouped in tables as each year s set of articles are in our News page collapsing or hiding a section s contents can be a convenient way to get a broad view of all of the table s data without having to scroll so much mosgoogle To
 

jQuery Table Manipulation

Learning jQuery Table Manipulation By Karl Swedberg Jonathan Chaffer Better Interaction Design and Web Development with Simple JavaScript Techniques Learning jQuery packtpub com jQuery book Table Manipulation Let em wear gaudy colors Or avoid display Devo Wiggly World" In the first si
 

SQL Table Commands

SQL Table Commands Overview As mentioned previously in this series of SQL articles, databases are primarily composed of tables. The “columns and rows” structure of the table allows data to be efficiently inserted, manipulated, updated, and deleted from the database. The three mos
 

The Interview Snafu

How to turn someone else’s mistake to your advantage Your dream job is about to become reality. A recruiter gave you the heads up about the perfect position at Humungous Conglomerate, Inc. You went through five interviews as well as a battery of psychological tests mandated by their HR de
 

Winning a Job Interview with a Winning Resume

Does your resume unlock your potential, take your skills to the highest level and win you the interview and the job you want now? The job market today is highly competitive and even if you think you have what it takes to get an interview you won’t get over the line without a polished, prof
 

Importance of Proper English during Job Interview

Importance of Proper English during Job Interview Your job interview is crucially important and it will determine whether or not you will get the job Depending on the type of job you re going for it is very important for you to use proper English In most cases jobs which offer higher salaries will h
 





About Us  |   Privacy Policy  |   Terms and Conditions  |   Contact  |   Site Map  |   Add Question  |   Propose Category  |   RSS Feeds  |   Articles Sitemap  |   Site Updates  |   Add Resource

Copyright © 2005 - 2008 GeekInterview.com. All Rights Reserved
Page copy protected against web site content infringement by Copyscape