Solved

asp.net - sample API insert a row into a databasae...

Posted on 2011-03-08
4
373 Views
Last Modified: 2012-05-11
does anyone have a sample API..that will allow a user to insert a row into MS SQL Server DB...in VB.NET...
0
Comment
Question by:GlobaLevel
  • 2
  • 2
4 Comments
 
LVL 18

Accepted Solution

by:
Anil Golamari earned 500 total points
ID: 35073550
some thing similar to this.

<WebMethod()>
 Public Function samplemethod(ByVal searchvalue As String) As string

Dim connStr As String = "Your connection string"       
Dim cmdTxt As String = "Sql query"
Dim myConn As New System.Data.SqlClient.SqlConnection(connStr)
Dim myCmd As New System.Data.SqlClient.SqlCommand(cmdTxt, myConn)
    Try
        myConn.Open()       
        myCmd.ExecuteNonQuery()
      
           Catch ex As Exception
               ' handle exception
           End Try
      
           If myConn.State = Data.ConnectionState.Open
 Then myConn.Close()
            myConn.Dispose()
           myCmd.Dispose()
      
       End Function
0
 
LVL 10

Author Comment

by:GlobaLevel
ID: 35074032
good stuff...one quick question...after inserting the value into the db...the web service then retrieves a .mp3 file and returns it to the client and plays automatically thru a media player...is this possible?  thanks in advance...
0
 
LVL 18

Expert Comment

by:Anil Golamari
ID: 35074060
I just want to understand clearly, Here one you insert some data into sql server then your web service has to retrieve a .mp3 file and return it too client right?
0
 
LVL 10

Author Comment

by:GlobaLevel
ID: 35074168
I just want to understand clearly, Here one you insert some data into sql server then your web service has to retrieve a .mp3 file and return it too client right?

> correct....Im not sure if SQL Server can hold .mp3 files..or if the web server will have to pull it from a file directory off the server and return it to the client...thanks
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now